Last active
July 27, 2020 16:51
-
-
Save MarcinKonowalczyk/8408e416c8ebc33287d05d938022336c to your computer and use it in GitHub Desktop.
[Matab] Image operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Bake-in colormap | |
Im = frame_stack(:,:,1); % Pick image | |
Im = Im-min(Im(:)); Im = Im./max(Im(:)); % Normalise | |
%Im = Im-prctile(Im(:),1); Im = Im./prctile(Im(:),99); % Normalise to percentiles | |
Im = round(Im*255); % 0-255 | |
cm = viridis(256); % Colormap (ideally uniform) | |
Im = ind2rgb(Im,cm); % Bake | |
figure(1); image(Im) % Looks good |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Save as multipage-tiff | |
filename = 'blah.tiff'; | |
D = frame_stack; | |
imwrite(D(:,:,1),filename); % Save first frame | |
for j = 2:size(D,3) | |
imwrite(D(:,:,j),filename,'WriteMode','append'); % Append all the other frames | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment