[Insight-users] beginner needs help (please)

Luis Ibanez luis . ibanez at kitware . com
Tue, 27 Aug 2002 13:40:40 -0400


Hi Alberto,

You may find Examples in the directory:

      Insight/Examples

They are of varied complexity...

--

About your code:

If you are reading an image from a file
using the ImageFileReader you don't need
to preallocate memory for the image.

The reader will obtain the appropiate
information from the file and allocate
the image for you.

A minimal example for reading a VTK image
will look like:


#include "itkImageFileReader.h"
#include "itkImage.h"

typedef itk::Image<char,3>               ImageType;
typedef itk::ImageFileReader<ImageType>  ReaderType;

ReaderType::Pointer  reader = ReaderType::New();

reader->SetFileName("colmod.vtk");

try{
       reader->Update();
}
catch( itk::ExceptionObject & ex )
{
   std::cerr << ex << std::endl;
}

ImageType::Pointer image = reader->GetOutput();





Luis



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

Alberto Bert wrote:

> Hi all,
> 
> I'm trying to understanding something about itk (2 days user.)
> 
> I've genarated an image using vtk and now I would like to import it.
> I've started watching the SampleProject example, but for me is very hard go further,
> without any documentation (but the Doxygen.)
> My little program compiles, but when I try to read the image, apparently it waits (obviously something
> is wrong :-(
> 
> I know that it is a stupid problem for most of you, but for me any help would be very precious, in order
> to start to undertand a little of the itk philosofy.
> 
> Furthermore, is there some kind of documentation describing the itk general concepts? Or
> some repository with a lot of simple examples for itk user?
> 
> Tank you very much,
> Alberto
> 
> Here is the code:
>