[Insight-users] i have a question about reading an image from a file

Luis Ibanez luis.ibanez at kitware.com
Sat Jun 28 21:20:42 EDT 2008



Hi Knoppix,



1) For instructions on how to write a CMakeLists.txt file
    please read the ITK Software Guide

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

   in particular section 2.2.1, "Hello World"

   The CMakeLists.txt file that you need should look like:


     PROJECT(ReadImage)
     FIND_PACKAGE(ITK REQUIRED)
     INCLUDE(${ITK_USE_FILE})

     ADD_EXECUTABLE(ReadImage ReadImage.cxx )
     TARGET_LINK_LIBRARIES(ReadImage ITKIO ITKCommon)


2) Yes, the input image file is 3D, as indicated by the
    line:

    >   const unsigned int             Dimension = 3;

    You will find 3D images at:

     http://public.kitware.com/pub/itk/Data/BrainWeb/

    download and untar the .tgz files.


3) To view the images you can use

      a) ImageViewer (source code in InsightApplications)
         binary for windows in:
http://public.kitware.com/pub/itk/InsightApplicationsBin/ImageViewer.exe

  or

      b) Slicer (www.slicer.org)

or

      c) SNAP (http://www.itksnap.org/)

or

      d) ParaView (www.paraview.org)


4)  The input of this program is any of the image fileformats
     supported by ITK:

        PNG
        JPEG
        TIFF
        Nrrd
        Analyze
        Nifti
        MINC
        DICOM
        MetaImage
        GIPL
        (among others...)




Please read the ITK Software Guide in order,
and follow the exercises with the proposed input
images in Insight/Examples/Data.

That will save you a lot of time.


     Regards,


         Luis



---------------------
knoppix corn wrote:
> haii.. i have a question about reading an image from a file,
> according to itkSoftwareGuide page 70, i have a source code like this :
> 
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> 
> int main( int , char * argv[])
> {
>   typedef unsigned char          PixelType;
>   const unsigned int             Dimension = 3;
> 
>   typedef itk::Image< PixelType, Dimension >   ImageType; 
> 
>   typedef itk::ImageFileReader< ImageType >  ReaderType;
>  
>   ReaderType::Pointer reader = ReaderType::New(); 
>  
>   const char * filename = argv[1];
>   reader->SetFileName( filename );
>  
>   reader->Update();
>  
>   ImageType::Pointer image = reader->GetOutput();
>  
>   return 0;
> }
> 
> i have a few question :
>  1). how to write a CMakeLists.txt ???
>  2). how with the image file?? , is the image file 3D?? , where can i 
> get the file??
>  3). to view the image, is it need VTK??
>  4). what is the input an output from this system or program???
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list