[Insight-users] what is the problem when calls reader->Update()?

xianjun.sun.ext_CRC xianjun.sun.ext at united-imaging.com
Fri Oct 26 05:40:16 EDT 2012


Hi, all,

   I adapted several cases ITK\Examples\Registration\ImageRegistration8, ImageRegistration9 and so on, however, I cannot even read out image . I'm sure that the image is well and verified this with the case of ITK\Examples\IO\ ImageReadDicomSeriesWrite.

   Maybe, my project's configuration is not right or other reasons, could anyone help me testing my code?


#include "stdafx.h"
#include "itkImageFileReader.h"
#include "itkCommand.h"

int main(int argc, char* argv[])
{
           const    unsigned int    Dimension = 3;
  typedef  short           PixelType;

  typedef itk::Image< PixelType, Dimension >  FixedImageType;
  typedef itk::ImageFileReader< FixedImageType  > FixedImageReaderType;
  FixedImageReaderType::Pointer  fixedImageReader  = FixedImageReaderType::New();
  fixedImageReader->SetFileName( argv[1] );
     try
    {
                   fixedImageReader->Update();
         }
         catch( itk::ExceptionObject & excp )
         {
                   std::cerr << "Exception thrown while reading the image" << std::endl;
                   std::cerr << excp << std::endl;
         }

           FixedImageType::RegionType fixedRegion = fixedImageReader->GetOutput()->GetBufferedRegion();
  FixedImageType::SizeType fixedImageSize = fixedRegion.GetSize();
  std::cout<<"fixed image size:                  "<<std::endl;
  std::cout<< fixedImageSize[0]<<std::endl;
  std::cout<< fixedImageSize[1]<<std::endl;
  std::cout<< fixedImageSize[2]<<std::endl;
  return 0;
}


When debug fixedImageReader->Update(), the Exception is as follows:

Exception thrown while reading the image

itk::ImageFileReaderException (0019F5A8)
Location: "void __thiscall itk::ImageFileReader<class itk::Image<short,3>,class
itk::DefaultConvertPixelTraits<short> >::GenerateOutputInformation(void)"
File: c:\program files (x86)\itk\include\itk-4.2\itkimagefilereader.hxx
Line: 143
Description:  Could not create IO object for file E:\multi_organ_segmentation\da
ta\LiverCT_models\Atlas\data_case2.nii
  Tried to create one of the following:
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.



fixed image size:
0
0
0


I am using:
 - VS 2010
 - Windows 7 64 bit.
and the platform I build my C++ projects is Win32.
ITK is installed in directory C:\Program Files (x86)\ITK,
VC+ + Directories ->Include Directories are filled with  C:\Program Files (x86)\ITK \include\ITK-4.2
VC+ + Directories ->Library Directories filled with C:\Program Files (x86)\ITK\ITK\lib
Linker->Input->Additional Dependencies filled with all .lib files under directory C:\Program Files (x86)\ITK\lib
environment variable ->path add C:\Program Files (x86)\ITK\bin

ITKBiasCorrection-4.2.lib
ITKBioCell-4.2.lib
ITKCommon-4.2.lib
ITKDeprecated-4.2.lib
ITKDICOMParser-4.2.lib
ITKEXPAT-4.2.lib
ITKFEM-4.2.lib
itkgdcmCommon-4.2.lib
itkgdcmDICT-4.2.lib
itkgdcmDSED-4.2.lib
itkgdcmIOD-4.2.lib
itkgdcmjpeg12-4.2.lib
itkgdcmjpeg16-4.2.lib
itkgdcmjpeg8-4.2.lib
itkgdcmMSFF-4.2.lib
ITKgiftiio-4.2.lib
itkhdf5-4.2.lib
itkhdf5_cpp-4.2.lib
ITKIOBioRad-4.2.lib
ITKIOBMP-4.2.lib
ITKIOCSV-4.2.lib
ITKIOGDCM-4.2.lib
ITKIOGE-4.2.lib
ITKIOGIPL-4.2.lib
ITKIOHDF5-4.2.lib
ITKIOImageBase-4.2.lib
ITKIOIPL-4.2.lib
ITKIOJPEG-4.2.lib
ITKIOLSM-4.2.lib
ITKIOMesh-4.2.lib
ITKIOMeta-4.2.lib
ITKIONIFTI-4.2.lib
ITKIONRRD-4.2.lib
ITKIOPNG-4.2.lib
ITKIOSiemens-4.2.lib
ITKIOSpatialObjects-4.2.lib
ITKIOStimulate-4.2.lib
ITKIOTIFF-4.2.lib
ITKIOTransformBase-4.2.lib
ITKIOTransformHDF5-4.2.lib
ITKIOTransformInsightLegacy-4.2.lib
ITKIOTransformMatlab-4.2.lib
ITKIOVTK-4.2.lib
ITKIOXML-4.2.lib
itkjpeg-4.2.lib
ITKKLMRegionGrowing-4.2.lib
ITKLabelMap-4.2.lib
ITKMesh-4.2.lib
ITKMetaIO-4.2.lib
itkNetlibSlatec-4.2.lib
ITKniftiio-4.2.lib
ITKNrrdIO-4.2.lib
itkopenjpeg-4.2.lib
ITKOptimizers-4.2.lib
ITKOptimizersv4-4.2.lib
ITKPath-4.2.lib
itkpng-4.2.lib
ITKPolynomials-4.2.lib
ITKQuadEdgeMesh-4.2.lib
ITKReview-4.2.lib
ITKSpatialObjects-4.2.lib
ITKStatistics-4.2.lib
itksys-4.2.lib
itktiff-4.2.lib
itkv3p_lsqr-4.2.lib
itkv3p_netlib-4.2.lib
itkvcl-4.2.lib
ITKVideoCore-4.2.lib
ITKVideoIO-4.2.lib
itkvnl-4.2.lib
ITKVNLInstantiation-4.2.lib
itkvnl_algo-4.2.lib
ITKVTK-4.2.lib
ITKWatersheds-4.2.lib
itkzlib-4.2.lib
ITKznz-4.2.lib


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121026/24ee50d5/attachment.htm>


More information about the Insight-users mailing list