[Insight-users] itkImageFileReader: could not create IO object

Matt McCormick matt.mccormick at kitware.com
Thu Dec 13 18:10:40 EST 2012


Hi Marcos,

For an example CMakeLists.txt's in a source tree, download a project from

  http://itk.org/ITKExamples/

such as


http://itk.org/ITKExamples/Examples/Filtering/BinaryMathematicalMorphology/DilateABinaryImage/DilateABinaryImage.tar.gz

HTH,
Matt


On Thu, Dec 13, 2012 at 5:22 AM, Matt McCormick
<matt.mccormick at kitware.com>wrote:

> Hi Marcos,
>
> Instead of using the GUI to add files, add files in the CMakeLists.txt.
>
> HTH,
> Matt
>
>
> On Wed, Dec 12, 2012 at 3:36 PM, Marcos <fotosentido at gmail.com> wrote:
>
>> Ok, I did that. I went through the "Cmake Wizard" and pressed "Run
>> Cmake". Everything ok. I can see a lot of namespaces inside "Class View".
>> Great.
>>
>> But I'm still lost. I want to use my code. I can't add my files to that
>> project. I feel I'm missing something too obvious, but I don't see it.
>>
>>
>>
>>
>> 2012/12/12 Matt McCormick <matt.mccormick at kitware.com>
>>
>>> Hi Marcos,
>>>
>>> Please try using CMake with QtCreator.  Do "File -> Open Project..." and
>>> select the top level project. CMakeLists.txt
>>>
>>> See, e.g.
>>>
>>>   http://doc.qt.digia.com/qtcreator-2.4/creator-project-cmake.html
>>>
>>> HTH,
>>> Matt
>>>
>>>
>>>
>>> On Wed, Dec 12, 2012 at 9:29 AM, Marcos <fotosentido at gmail.com> wrote:
>>>
>>>> I'm not using a CmakeLists.txt. It's a existing Qt Creator project, so
>>>> I'm using a project.pro file, where you configure the directories with
>>>> libraries and header files. The same for vtk. I was trying to use mitk, but
>>>> it I think it only works with cmake files (still trying).
>>>>
>>>> In the .pro file:
>>>>
>>>> INCLUDEPATH     +=  /usr/local/include/vtk-5.10
>>>> LIBS            +=  -L/usr/local/lib/vtk-5.10 \
>>>>                     -lvtkNetCDF_cxx -lvtkVolumeRendering \
>>>>                     -lvtkCommon -lvtksys...
>>>>
>>>>
>>>> INCLUDEPATH     +=  /usr/local/include/ITK-4.2
>>>> LIBS            +=  -L/usr/local/lib \
>>>>                     -lvtkNetCDF_cxx -lvtkVolumeRendering \
>>>>                     -lITKVideoIO-4.2 -lITKVideoCore-4.2 -lITKReview-4.2
>>>> -lITKOptimizersv4-4.2 \
>>>>                     -lITKIOTransformMatlab-4.2
>>>> -lITKIOTransformInsightLegacy-4.2 -lITKIOTransformHDF5-4.2 \
>>>>                     -lITKIOTransformBase-4.2 -lITKIOHDF5-4.2
>>>> -lITKIOCSV-4.2 -litkhdf5_cpp-4.2 \
>>>>                     -litkhdf5-4.2 -lITKWatersheds-4.2 -lITKVTK-4.2
>>>> -lITKKLMRegionGrowing-4.2 \
>>>>                     -lITKIOSiemens-4.2 -lITKIOGE-4.2 -lITKIOIPL-4.2
>>>> -lITKFEM-4.2 -lITKDICOMParser-4.2 \
>>>>                     -lITKBioCell-4.2 -lITKBiasCorrection-4.2
>>>> -lITKPolynomials-4.2 -lITKQuadEdgeMesh-4.2 \
>>>>                     -lITKLabelMap-4.2 -lITKIOMesh-4.2 -lITKgiftiio-4.2
>>>> -lITKIOSpatialObjects-4.2 \
>>>>                     -lITKIOXML-4.2 -lITKOptimizers-4.2
>>>> -lITKSpatialObjects-4.2 -lITKMesh-4.2 \
>>>>                     -lITKPath-4.2 -lITKStatistics-4.2
>>>> -litkNetlibSlatec-4.2 -lITKIOLSM-4.2 \
>>>>                     -lITKIOVTK-4.2 -lITKIOStimulate-4.2 -lITKIONRRD-4.2
>>>> -lITKNrrdIO-4.2 -lITKIOBMP-4.2 \
>>>>                     -lITKIOBioRad-4.2 -lITKIOGDCM-4.2 -litkgdcmMSFF-4.2
>>>> -litkgdcmjpeg12-4.2 \
>>>>                     -litkgdcmjpeg8-4.2 -litkgdcmuuid-4.2
>>>> -litkgdcmjpeg16-4.2 -litkopenjpeg-4.2 \
>>>>                     -litkgdcmDICT-4.2 -litkgdcmIOD-4.2 -lITKEXPAT-4.2
>>>> -litkgdcmDSED-4.2 -litkgdcmCommon-4.2 \
>>>>                     -lITKIOMeta-4.2 -lITKMetaIO-4.2 -lITKIOTIFF-4.2
>>>> -litktiff-4.2 -lITKIOGIPL-4.2 \
>>>>                     -lITKIOJPEG-4.2 -litkjpeg-4.2 -lITKIONIFTI-4.2
>>>> -lITKniftiio-4.2 -lITKznz-4.2 \
>>>>                     -lITKIOPNG-4.2 -litkpng-4.2 -litkzlib-4.2
>>>> -lITKIOImageBase-4.2 -lITKCommon-4.2 \
>>>>                     -lITKVNLInstantiation-4.2 -litkvnl_algo-4.2
>>>> -litkvnl-4.2 -litkv3p_lsqr-4.2 \
>>>>                     -litkvcl-4.2 -litkv3p_netlib-4.2 -litksys-4.2
>>>>
>>>> I think I added all libs, even those I don't need.
>>>>
>>>>
>>>>
>>>>
>>>> 2012/12/12 Bradley Lowekamp <blowekamp at mail.nih.gov>
>>>>
>>>>> It sounds like ITK's imageIO factories are not being registered.
>>>>>
>>>>> What does your cmake code look like?
>>>>>
>>>>>
>>>>> On Dec 12, 2012, at 7:54 AM, Marcos <fotosentido at gmail.com> wrote:
>>>>>
>>>>> I'm using ITK 4.2 with Qt Creator.
>>>>>
>>>>> Trying to read several images, I always get the same:
>>>>>
>>>>> itk::ImageFileReaderException (0x1efccb0) Location: "void
>>>>> itk::ImageFileReader::GenerateOutputInformation() [with TOutputImage =
>>>>> itk::Image; ConvertPixelTraits = itk::DefaultConvertPixelTraits]"
>>>>>
>>>>> File: /usr/local/include/ITK-4.2/itkImageFileReader.hxx Line: 143
>>>>>
>>>>> Description: *Could not create IO object* for file /home/marcos/d2.dcm
>>>>>
>>>>> Tried to create one of the following: You probably failed to set a
>>>>> file suffix, or set the suffix to an unsupported type.
>>>>>
>>>>> I've successfully readed it with
>>>>>
>>>>> vtkGDCMImageReader* reader = vtkGDCMImageReader::New();
>>>>> reader->SetFileName(fileName);
>>>>> reader->Update();
>>>>> vtkImageData* imageData = reader->GetOutput();
>>>>> cout << "imageData->GetScalarTypeAsString(): " << imageData->GetScalarTypeAsString() << endl;
>>>>>
>>>>> And *GetScalarTypeAsString()* returns *unsigned short*. Anyway, I
>>>>> tried with unsigned long, unsigned int, double, int, short, short unsigned
>>>>> int, unsigned char... I got the same.
>>>>>
>>>>> Edit: other tip, with gdcminfo I get UINT16 as ScalarType.
>>>>>
>>>>> This is the code:
>>>>>
>>>>> typedef itk::Image <unsigned short> ImageType;
>>>>> typedef itk::ImageFileReader<ImageType> ReaderType;
>>>>> ReaderType::Pointer reader = ReaderType::New();
>>>>> try
>>>>> {
>>>>>     reader->SetFileName(nombreFichero);
>>>>> }
>>>>> catch (itk::ExceptionObject& excep)
>>>>> {
>>>>>     cerr << excep << endl;
>>>>>     return;
>>>>> }
>>>>>
>>>>> Any ideas? Thanks in advance.
>>>>>
>>>>>  _____________________________________
>>>>> 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/20121213/7e48eb48/attachment.htm>


More information about the Insight-users mailing list