[Insight-users] ImageFileReader problem

Luis Ibanez luis.ibanez@kitware.com
Mon, 08 Apr 2002 12:33:44 -0400


Hi Lydia

Thanks for sending us your code.

Here is the problem, in your declaration
you were using "itk::itkFileReader"
instead of "itk::ImageFileReader":

//original declaration in line 99
typedef 
itk::itkFileReader<ImageType>  rawreader;
rawreader = itk::ImageFileReader<ImageType>::New();

// Here is how it should be:
typedef itk::ImageFileReader<ImageType>  ReaderType;
ReaderType::Pointer rawreader = ReaderType::New();

Please note that it is better to first declare the
type (e.g. ReaderType) and then use it for defining
the Pointer to the object and for calling the appropiate
New() method.

---

You also need to add to the CMakeLists.txt file
the ITK IO library. This is done in :

LINK_LIBRARIES (
VXLNumerics
ITKCommon
ITKIO     <----- here !
)


Hope that helps

Luis


PS, please never remove the "#defines" on the
headers. They are quite important for preventing
the declarations to be done several times, and
problems caused by missing #defines are pretty hard
to track.

===================================================

ycl lydia wrote:
> Hi lUis
> This iy my project. Actually, I'm using the sample project example. I 
> built it using cmakesetup and now I want to read some raw files.
> I used the class itkImageFileReader but it doesn't recognize the class. 
> I went into the header itkImagefileReader.h and removed the first line
> "#define __itkImageFileReader_h" but I got some error messages 
> concerning imageIOBase inside the header.
> I'm sure that there are some setting problems but I couldn't find them.
> Thanks a lot for your precious help
> lydia
> 
>