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

alex Dowson alexdowson at hotmail.com
Fri Oct 26 07:10:42 EDT 2012



In CMake  enable ITK_USE_SYSTEM_GDCM 



 

From: xianjun.sun.ext_CRC 
Sent: Friday, October 26, 2012 4:36 PM
To: Saurabh Garg 
Cc: insight-users at itk.org 
Subject: [Insight-users] 答复: what is the problem when calls reader->Update()?

・         Thank your reply, but there are emerging new questions.

 

#define ITK_IO_FACTORY_REGISTER_MANAGER

#include "itkImageFileReader.h"

 

 

1>c:\program files (x86)\itk\include\itk-4.2\itkimagefilereader.h(197): fatal error C1083: Cannot open include file: 'itkImageIOFactoryRegisterManager.h': No such file or directory

1>

1>Build FAILED.

 

The file itkImageIOFactoryRegisterManager.h is not existing under C:\Program Files (x86)\ITK \include\ITK-4.2, I find that it exists under output directories of ITK cmake. I included it in my project anyway and built it

 

1>itkgdcmMSFF-4.2.lib(gdcmUIDGenerator.obj) : error LNK2019: unresolved external symbol __imp__UuidCreate at 4 referenced in function "protected: static bool __cdecl gdcm::UIDGenerator::GenerateUUID(unsigned char *)" (?GenerateUUID at UIDGenerator@gdcm@@KA_NPAE at Z)

1>itkgdcmCommon-4.2.lib(gdcmSystem.obj) : error LNK2019: unresolved external symbol _WSACleanup at 0 referenced in function "public: static bool __cdecl gdcm::System::GetHostName(char * const)" (?GetHostName at System@gdcm@@SA_NQAD at Z)

1>itkgdcmCommon-4.2.lib(gdcmSystem.obj) : error LNK2019: unresolved external symbol _gethostname at 8 referenced in function "public: static bool __cdecl gdcm::System::GetHostName(char * const)" (?GetHostName at System@gdcm@@SA_NQAD at Z)

1>itkgdcmCommon-4.2.lib(gdcmSystem.obj) : error LNK2019: unresolved external symbol _WSAStartup at 8 referenced in function "public: static bool __cdecl gdcm::System::GetHostName(char * const)" (?GetHostName at System@gdcm@@SA_NQAD at Z)

1>E:\ITK\ItkToolsforRegTest\readnii\Debug\readnii.exe : fatal error LNK1120: 4 unresolved externals

1>

1>Build FAILED.

 

 

发件人: Saurabh Garg [mailto:srbh.garg at gmail.com] 
发送时间: 2012年10月26日 18:44
收件人: xianjun.sun.ext_CRC
抄送: insight-users at itk.org
主题: Re: [Insight-users] what is the problem when calls reader->Update()?

 

Hi,

This exception is thrown when ITK does not recognize the file format that you are trying to read or write. I believe that the different ImageIO factories are not registered. To confirm, can you do the following in your code and see if it works:

Define this variable (ITK_IO_FACTORY_REGISTER_

MANAGER) before you
include itkImageFileReader.h file. This will register all the
different IOs and then you can use them.
-----------------
#define ITK_IO_FACTORY_REGISTER_MANAGER
#include <itkImageFileReader.h>

HTH,
Saurabh

 

On Fri, Oct 26, 2012 at 2:40 AM, xianjun.sun.ext_CRC <xianjun.sun.ext at united-imaging.com> wrote:

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

 

 


_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users

 



--------------------------------------------------------------------------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121026/9c925062/attachment-0001.htm>


More information about the Insight-users mailing list