[Insight-users] 答复: 答复: Problem With ITKImageIO

吴鹏飞 wpfnihao at gmail.com
Thu Jul 5 12:26:19 EDT 2012


Thanks for your advice. I’ll study the examples.

 

发件人: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
发送时间: 2012年7月5日 23:46
收件人: 吴鹏飞
抄送: insight-users at itk.org
主题: Re: 答复: [Insight-users] Problem With ITKImageIO

 

It is not easy to use ITKv4 without cmake. There are many examples on the wiki that include sample cmake files. See for example see:

http://itk.org/Wiki/ITK/Examples/QuickView

 

 

On Thu, Jul 5, 2012 at 10:49 AM, 吴鹏飞 <wpfnihao at gmail.com> wrote:

Hi Bill,

         Thanks for your reply. But I use VS 2010 to compile the code, I’m not familiar with the CMake grammar. 

 

Here’s some information of my project (the vtk related info. is omitted).

 

The include directory:

C:\Program Files (x86)\ITK\include\ITK-4.1

C:\Program Files (x86)\ITK\include

 

The library directory: 

C:\Program Files (x86)\ITK\lib

 

Additional dependence (I include all the lib files in the  ./ITK/lib directory):

itksys-4.1.lib

itkvnl_algo-4.1.lib

itkvnl-4.1.lib

itkv3p_netlib-4.1.lib

ITKCommon-4.1.lib

itkNetlibSlatec-4.1.lib

ITKStatistics-4.1.lib

ITKIOImageBase-4.1.lib

ITKIOBMP-4.1.lib

ITKIOBioRad-4.1.lib

ITKEXPAT-4.1.lib

itkopenjpeg-4.1.lib

itkzlib-4.1.lib

itkgdcmDICT-4.1.lib

itkgdcmMSFF-4.1.lib

ITKIOGDCM-4.1.lib

ITKIOGIPL-4.1.lib

itkjpeg-4.1.lib

ITKIOJPEG-4.1.lib

itktiff-4.1.lib

ITKIOTIFF-4.1.lib

ITKIOLSM-4.1.lib

ITKMetaIO-4.1.lib

ITKIOMeta-4.1.lib

ITKznz-4.1.lib

ITKniftiio-4.1.lib

ITKIONIFTI-4.1.lib

ITKNrrdIO-4.1.lib

ITKIONRRD-4.1.lib

itkpng-4.1.lib

ITKIOPNG-4.1.lib

ITKIOStimulate-4.1.lib

ITKIOVTK-4.1.lib

ITKMesh-4.1.lib

ITKSpatialObjects-4.1.lib

ITKPath-4.1.lib

ITKLabelMap-4.1.lib

ITKQuadEdgeMesh-4.1.lib

ITKOptimizers-4.1.lib

ITKPolynomials-4.1.lib

ITKBiasCorrection-4.1.lib

ITKBioCell-4.1.lib

ITKDICOMParser-4.1.lib

ITKIOXML-4.1.lib

ITKIOSpatialObjects-4.1.lib

ITKFEM-4.1.lib

ITKIOIPL-4.1.lib

ITKIOGE-4.1.lib

ITKIOSiemens-4.1.lib

ITKKLMRegionGrowing-4.1.lib

ITKVTK-4.1.lib

ITKWatersheds-4.1.lib

ITKDeprecated-4.1.lib

ITKgiftiio-4.1.lib

ITKIOMesh-4.1.lib

itkhdf5_cpp-4.1.lib

itkhdf5-4.1.lib

ITKIOCSV-4.1.lib

ITKIOHDF5-4.1.lib

ITKIOTransformBase-4.1.lib

ITKIOTransformHDF5-4.1.lib

ITKIOTransformInsightLegacy-4.1.lib

ITKIOTransformMatlab-4.1.lib

ITKOptimizersv4-4.1.lib

ITKReview-4.1.lib

ITKVideoCore-4.1.lib

ITKVideoIO-4.1.lib

itkgdcmIOD-4.1.lib

itkgdcmDSED-4.1.lib

itkgdcmCommon-4.1.lib

itkgdcmjpeg8-4.1.lib

itkgdcmjpeg12-4.1.lib

itkgdcmjpeg16-4.1.lib

rpcrt4.lib

comctl32.lib

wsock32.lib

ws2_32.lib

ITKVNLInstantiation-4.1.lib

itkv3p_lsqr-4.1.lib

itkvcl-4.1.lib

 

 

Regards,

Wu, Pengfei

 

发件人: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
发送时间: 2012年7月5日 22:19
收件人: 吴鹏飞
抄送: insight-users at itk.org
主题: Re: [Insight-users] Problem With ITKImageIO

 

Please show us your CMakeLists.txt file.

On Thu, Jul 5, 2012 at 7:57 AM, 吴鹏飞 <wpfnihao at gmail.com> wrote:

Hello all,

 

I am new to itk and tried to write my first program using itk and vtk to show an image, but I encountered a strange problem. It seems that my itk can’t infer from the file extension which ImageIO to use. If I commented the phrase  

reader->SetImageIO(itk::JPEGImageIO::New());

out, the error 

       “Could not create IO object for file E:\1340858885.jpg

    Tried to create one of the following:

    You probably failed to set a file suffix, or

    set the suffix to an unsupported type.”

occurred, but the program worked properly with the phrase mentioned above. See my source code attached at the end of this mail.

       Is there someone can tell me why this happened?

 

Thanks a lot in advance!

 

Wu, Pengfei

 

Code:

  _____  

int main(int argc, char* argv[])

{

    typedef itk::RGBPixel<unsigned short>  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 = "E:\\1340858885.jpg";

    //reader->SetImageIO(itk::JPEGImageIO::New());

    reader->SetFileName(filename);

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

 

 

    typedef itk::ImageToVTKImageFilter<ImageType> FilterType;

    FilterType::Pointer connecter = FilterType::New();

    connecter->SetInput(image);

    vtkImageViewer *viewer = vtkImageViewer::New();

    vtkRenderWindowInteractor *renderWindowInteractor = vtkRenderWindowInteractor::New();

    viewer->SetupInteractor(renderWindowInteractor);

    viewer->SetInput(connecter->GetOutput());

    viewer->Render();

    viewer->SetColorWindow(255);

    viewer->SetColorLevel(128);

    renderWindowInteractor->Start();

    cin.get();

    return 0;

}

-------------------------------------End of Code-------------------------------------------------------------


_____________________________________
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





 

-- 
Unpaid intern in BillsBasement at noware dot com





 

-- 
Unpaid intern in BillsBasement at noware dot com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120706/5bb6f678/attachment.htm>


More information about the Insight-users mailing list