[Insight-users] displaying image error

Luis Ibanez luis.ibanez at kitware.com
Thu Mar 15 18:16:11 EST 2007


Hi Alireza,

The code in this example is not intended to display an image.

In fact, there is nothing in ITK that will display an image.
ITK provides functionalities for segmentation and registration
of image, but not for visualization.

You may wan to use VTK  for displaying images.

VTK and ITK are quite complementary, and usually
you want to use them together in any image processing
application.

You will find examples of how to use ITK along with VTK
in the directory:

          InsightlApplications/Auxiliary/vtk



If you prefer to continue your study of ITK, you can
simply save the image using the itkImageFileWriter
and then open it with any image viewer available in
your machine.


Regards,


     Luis


--------------------------------------------------------------------------------------
On 3/15/07, Alireza Salamy <alireza_sal2000 at yahoo.com> wrote:
> Hi all,
>   I am trying to  display image (from insight data for
> example:BrainT1SliceBorder20.png)from file by using the code which is
> available at insight/example/Datarepresentation/image2.cxx
>   but I am not quite sure if I need to add anything more for displaying the
> image or not.my code is as follow:
>   #include "itkImage.h"
>   #include "itkImageFileReader.h"
>   int main( int , char * argv[])
>   {
>
> typedef unsigned char PixelType;
>   const unsigned int Dimension = 2;
>   typedef itk::Image< PixelType, Dimension > ImageType;
>
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
> ReaderType::Pointer reader = ReaderType::New();
>
> const char * filename = argv[1];
>   reader->SetFileName( "BrainT1SliceBorder20.png" );
>   reader->Update();
>   ImageType::Pointer image = reader->GetOutput();
>
> reader->Update();
>
> ImageType::Pointer image = reader->GetOutput(
> return 0;
>   }
>
>   thank you for your help
>
>
> ---------------------------------
> TV dinner still cooling?
> Check out "Tonight's Picks" on Yahoo! TV.


More information about the Insight-users mailing list