How to read and view the .tif file in MATLAB?

How can i view the .tiff file. I am able to read the .tif file but i am not able to view it. I used the following code to view, but its not working.
% DICOM Example Script
clear all; close all; clc
% Read all Tiff images
obj = Tiff('clipped_row2.tif','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');

4 Comments

How about using imread and imshow functions? In the help page of these functions, you can find how to read and view .tiff image file.
KSSV
KSSV on 31 Jul 2017
Edited: KSSV on 31 Jul 2017
Is it a geo tiff file? It sems you are trying to read a geo tiff file....viewing depends on what information file has....
Its a geo tiff file
I'm not familiar with geoTIFF file, but MATLAB Mapping Toolbox has geotiffread and mapshow functions to read and view geoTIFF file, respectively. Please take a look at help page of these functions.

Sign in to comment.

Answers (1)

You will need to
permute(x, [1 2 4 3])
to get the RGB into the place that vol3d expects.

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Asked:

on 29 Jul 2017

Commented:

on 31 Jul 2017

Community Treasure Hunt

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

Start Hunting!