[Insight-users] Reading TIFF

Luis Ibanez luis.ibanez at kitware.com
Tue, 27 Jan 2004 18:23:25 -0500


Hi Swati,

The ITK examples are independent of the file
format used for storing your images.

You may want to read the IO chapter in the
SoftwareGuide in order to get familiar with
the ITK fileformat architecture.  The use of
dynamic factories allows to write code that
simply uses the itk::ImageFileReader<> and
itk::ImageFileWriter<> and only at run time
will search for the appropriate ImageIO classes
capable of actually reading a particular image
file format.


Please look at

   http://www.itk.org/ItkSoftwareGuide.pdf

Chapter 7, pdf-page 219.


The examples that are distributed with ITK
are built and tested nightly on the Dashboard.
You are simply using a fileformat for which there
was not an ImageIO factory available in ITK 1.4.

The same will happen to you if you try to open
a GIF file with ITK 1.6,.... there is not an
ImageIO factory for this format...,

However, two weeks from now somebody may contribute
one.  At that point, all the examples that  are already
working with formats such as DICOM, Analyze, GIPL,
VTK, PNG, TIFF, JPEG, META, Brains, GE4, GE5,..
will also work with the hypothetically added GIF,
and this without having to change anything in the
source code of the example.


Please let us know if you find any problem
reading/writing TIFF files with ITK 1.6.



Thanks



    Luis



-----------------
Swati Mital wrote:

> Hi Luis,
> 
> I was using ITK 1.4.  Now I am downloading the latest version (which was btw
> not available a week ago) from ITK website.  Hope the problem will be
> resolved now.  But I am surprised that the IO examples are included in ITK
> 1.4 even when they are not compatible.
> 
> Swati
> ----- Original Message -----
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "Swati Mital" <swati_mital at hotmail.com>
> Cc: <insight-users at itk.org>
> Sent: Tuesday, January 27, 2004 11:22 PM
> Subject: Re: [Insight-users] Reading TIFF
> 
> 
> 
>>Hi Swati,
>>
>>What version of ITK are you using ?
>>
>>The TIFF ImageIO class was added only
>>recently (Nov 25 2003). It may be that
>>your version is previous to this addition.
>>For example, if you are using ITK 1.4, the
>>tiff reader/writer will not be available.
>>
>>Have you set a try/catch block around
>>the Update() call ?
>>
>>The message from the exception will
>>help you figure out the source of the
>>error.
>>
>>
>>I just verified using:
>>
>>  Insight/Examples/IO/RGBImageReadWrite.cxx
>>
>>and works fine for converting the image:
>>
>>  Insight/Examples/Data/VisibleWomanEyeSlice.png
>>
>>into
>>
>>   VisibleWomanEyeSlice.tif
>>
>>or
>>
>>   VisibleWomanEyeSlice.tiff
>>
>>
>>No modifications are needed in the
>>RGBImageReadWrite.cxx file.
>>
>>
>>Regards,
>>
>>
>>    Luis
>>
>>
>>-------------------
>>Swati Mital wrote:
>>
>>
>>>I am trying to read/write a tiff file using itkFileReader as in
>>>RGBReadWrite.cxx example.  The program throws exception when trying to
>>>Update() writer.  Basically, m_input and m_output values of the Smart
>>>Pointer are not being set.
>>>
>>>I tried alternatively by reading the TIFF file using libtiff and then
>>>importing the data into ITK data structures.  It seems to be working
>>>fine, but when I call SetInput on a pointer in order to load the image
>>>data it doesn't work.
>>>
>>>I think the problem lies in configuring the toolkit using CMake.  I may
>>>have missed to turn on some option.  Can anyone please let me know what
>>>are the minimum options required to get the examples in the IO directory
>>>of the toolkit working?
>>>
>>>Thank you
>>>Swati
>>>
>>>
>>
>>
>>
>>
>