How do I load a 3D image(.tiff) into a 3D plot?

36 views (last 30 days)
I'm a new MATLAB user and I'm trying to load a 3d image(.tiff) into a 3d plot and be able to generate different projections in different planes. Can anyone recommend sample commands that would be useful or even how to go about this? Thanks
  2 Comments
Walter Roberson
Walter Roberson on 3 Jun 2015
Do you mean that you have a TIFF that has Samples Per Pixel set to 3 times the number of color planes and the ExtraSamples is set to Unspecified Data for each sample beyond the usual 3?
Or do you mean that you have a TIFF file that has multiple IFD (file directories entries), each specifying an RGB image, and there is some kind of explicit or implicit Z stacking order for them?
3D images are usually saved in DICOM format, not in TIFF format.
Dennis Nyanyo
Dennis Nyanyo on 8 Jun 2015
I have a tiff file that has multiple RGB images arranged in a Z stack using ImageJ

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 8 Jun 2015
Basically, open the TIFF file, use the read() method to get the current image, use nextDirectory to position to the second image, read() its contents, and so on. Use lastDirectory to determine whether you have reached the end of the series.
  2 Comments
SP
SP on 24 Aug 2016
Edited: SP on 24 Aug 2016
Hello Walter, You are correct that DICOM is one of the standard formats for viewing such images. I used the methods you mentioned and DICOM library in MATLAB to convert my TIFF image stack into DICOM. However, I am still unable to view the DICOM in 3D in MATLAB-2015. How should I go about viewing this DICOM (X in the code below)?
% DICOM Example Script
clear all; close all; clc
% Read all Tiff images
obj = Tiff('Mouse1-Day1.tiff','r');
i = 1;
while 1
subimage = obj.read();
subimages(:,:,:,i) = subimage(:,:,1:3);
if (obj.lastDirectory())
break;
end
obj.nextDirectory()
i = i+1;
end
dicomwrite( subimages, 'output_image.dcm');
dicomanon('output_image.dcm', 'output_anon.dcm');
X = dicomread('output_image.dcm');
Walter Roberson
Walter Roberson on 24 Aug 2016
?? DICOM is not a standard for viewing images. DICOM is a multipart standard for storing images, transmitting images, and various other things, but not for viewing them. There is no advantage to converting the TIFF images to DICOM for viewing in MATLAB (though it could potentially be a useful step for third-party DICOM volume visualizers, some of which are quite good.)

Sign in to comment.

Categories

Find more on DICOM Format in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!