[Insight-users] ITK 4.1 ImageIOFactory Could not create IO Object
Bill Lorensen
bill.lorensen at gmail.com
Tue May 22 15:01:11 EDT 2012
No need to change the reader output type. The reader will internnaly
convert to whatever type the user specifies.
Sebastien,
Please post your complete compilable example and your CMakeLists.txt file.
On Tue, May 22, 2012 at 12:11 PM, Cagatay Bilgin <bilgincc at gmail.com> wrote:
> It is your input file that you are having problems
> with. PNG supports unsigned char or unsigned
> short but you are trying to read your input as
> double. You need to change this
>
> typedef itk::ImageFileReader<DoubleImageType> ReaderType;
> to
> typedef itk::ImageFileReader<IntImageType> ReaderType;
> and modify the rest of your code keeping the imagetypes
> consistent.
>
> Cheers,
> Cagatay
>
>
> On Tue, May 22, 2012 at 7:42 AM, Sebastian Losch <seb.losch at googlemail.com>
> wrote:
>>
>> hi Bill!
>>
>> it is the same as in my first posting. Sorry, i thought i made that clear.
>>
>> Description: Could not create IO object for file input.png
>>
>> 2012/5/22 Bill Lorensen <bill.lorensen at gmail.com>
>>>
>>> Pleases post the complete line for
>>> Description: Could not create IO object for fi
>>>
>>>
>>> On Tue, May 22, 2012 at 9:30 AM, Sebastian Losch
>>> <seb.losch at googlemail.com> wrote:
>>> > Hm okay, i just created a solution for visual studio using this
>>> > helloworld
>>> > cmake project as basis. The only difference is that there are more
>>> > Image
>>> > types he tried, but it is not working. I did try it with JPEG instead
>>> > of
>>> > PNG, i had to use a castimagefilter in order to use it with the canny
>>> > filter
>>> > which only support real values. No errors, but the output image is just
>>> > black.
>>> >
>>> > Some other ideas?
>>> >
>>> > This is the error:
>>> >
>>> > Description: Could not create IO object for fi
>>> > Tried to create one of the following:
>>> > JPEGImageIO
>>> > GDCMImageIO
>>> > BMPImageIO
>>> > LSMImageIO
>>> > PNGImageIO
>>> > TIFFImageIO
>>> > VTKImageIO
>>> > StimulateImageIO
>>> > BioRadImageIO
>>> > MetaImageIO
>>> > NiftiImageIO
>>> > NrrdImageIO
>>> > GiplImageIO
>>> > HDF5ImageIO
>>> > PNGImageIO
>>> > JPEGImageIO
>>> > You probably failed to set a file suffix, or
>>> > set the suffix to an unsupported type.
>>> >
>>> > 2012/5/22 Sebastian Losch <seb.losch at googlemail.com>
>>> >>
>>> >> Hi Brad,
>>> >>
>>> >> thanks for your response. I should have mentioned in my first post
>>> >> that i
>>> >> am using Visual Studio 2010 on a Win7 32bit machine. I've read that
>>> >> this
>>> >> problem can be solved by adding include(${ITK_USE_FILE}) to the
>>> >> makefile.
>>> >> But what is the corresponding way to do it in visual studio?
>>> >>
>>> >> Thanks, Sebastian
>>> >>
>>> >>
>>> >> 2012/5/22 Bradley Lowekamp <blowekamp at mail.nih.gov>
>>> >>>
>>> >>> Most likely this is a problem with how you are using CMake for ITK
>>> >>> and is
>>> >>> not related to the code you have included here.
>>> >>>
>>> >>> There is an example of what a basic CMake project which uses ITK
>>> >>> should
>>> >>> like like int ITK/Examples/Installation/CMakeLists.txt
>>> >>>
>>> >>>
>>> >>>
>>> >>> http://itk.org/gitweb?p=ITK.git;a=blob;f=Examples/Installation/CMakeLists.txt;h=5e1b9e7ae0a95430f5162e8ff435b98570c5ad6e;hb=HEAD
>>> >>>
>>> >>> Hopefully, this will get you started in the right direction to solve
>>> >>> you
>>> >>> problem.
>>> >>>
>>> >>> Brad
>>> >>>
>>> >>>
>>> >>> On May 22, 2012, at 4:35 AM, Sebastian Losch wrote:
>>> >>>
>>> >>> Hi!
>>> >>>
>>> >>> I am having problems getting the ImageFileReader and ImageFileWriter
>>> >>> to
>>> >>> work. I just want to read a PNG File, apply a filter and write it
>>> >>> back to
>>> >>> the harddrive. I found out that there is a problem in 4.1 with the
>>> >>> ImageIOFactory registration, so i register the PNGFactory manually.
>>> >>> The .png
>>> >>> file is in the same folder as the executable. Here is my Code:
>>> >>>
>>> >>> #include "itkImage.h"
>>> >>> #include "itkImageFileReader.h"
>>> >>> #include "itkImageFileWriter.h"
>>> >>> #include "itkCannyEdgeDetectionImageFilter.h"
>>> >>> #include "itkObjectFactoryBase.h"
>>> >>> #include "itkPNGImageIOFactory.h"
>>> >>>
>>> >>> int main(int argc, char *argv[])
>>> >>> {
>>> >>>
>>> >>> itk::ObjectFactoryBase::RegisterFactory(itk::PNGImageIOFactory::New());
>>> >>>
>>> >>>
>>> >>> double variance = 2.0;
>>> >>> double upperThreshold = 0.0;
>>> >>> double lowerThreshold = 0.0;
>>> >>>
>>> >>> typedef itk::Image<double, 2> DoubleImageType;
>>> >>>
>>> >>> typedef itk::ImageFileReader<DoubleImageType> ReaderType;
>>> >>> ReaderType::Pointer reader = ReaderType::New();
>>> >>> reader->SetFileName("input.png");
>>> >>>
>>> >>> typedef itk::CannyEdgeDetectionImageFilter <DoubleImageType,
>>> >>> DoubleImageType>
>>> >>> CannyEdgeDetectionImageFilterType;
>>> >>>
>>> >>> CannyEdgeDetectionImageFilterType::Pointer cannyFilter =
>>> >>> CannyEdgeDetectionImageFilterType::New();
>>> >>> cannyFilter->SetInput(reader->GetOutput());
>>> >>> cannyFilter->SetVariance( variance );
>>> >>> cannyFilter->SetUpperThreshold( upperThreshold );
>>> >>> cannyFilter->SetLowerThreshold( lowerThreshold );
>>> >>>
>>> >>> typedef itk::ImageFileWriter<DoubleImageType> WriterType;
>>> >>> WriterType::Pointer writer = WriterType::New();
>>> >>>
>>> >>> writer->SetFileName("test.png");
>>> >>> writer->SetInput(cannyFilter->GetOutput());
>>> >>>
>>> >>> try {
>>> >>> writer->Update();
>>> >>> } catch (itk::ExceptionObject &e) {
>>> >>> std::cerr << e << std::endl;
>>> >>> }
>>> >>>
>>> >>> std::cout << "ENDE" << std::endl;
>>> >>> }
>>> >>>
>>> >>> and this is the error:
>>> >>>
>>> >>> itk::ImageFileReaderException (0059E4A8)
>>> >>> Location: "void __thiscall itk::ImageFileReader<class
>>> >>> itk::Image<double,2>,class itk::DefaultConvertPixelTraits<double>
>>> >>> >::GenerateOutputInformation(void)"
>>> >>> File: c:\libs\itk\include\itk-4.1\itkimagefilereader.hxx
>>> >>> Line: 143
>>> >>> Description: Could not create IO object for file input.png
>>> >>> Tried to create one of the following:
>>> >>> PNGImageIO
>>> >>> You probably failed to set a file suffix, or
>>> >>> set the suffix to an unsupported type.
>>> >>>
>>> >>>
>>> >>> What am i doing wrong?
>>> >>>
>>> >>> Thanks in advance, Sebastian
>>> >>> _____________________________________
>>> >>> 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
>>> >>>
>>> >>>
>>> >>> ========================================================
>>> >>>
>>> >>> Bradley Lowekamp
>>> >>>
>>> >>> Medical Science and Computing for
>>> >>>
>>> >>> Office of High Performance Computing and Communications
>>> >>>
>>> >>> National Library of Medicine
>>> >>>
>>> >>> blowekamp at mail.nih.gov
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>
>>> >
>>> >
>>> > _____________________________________
>>> > 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
>>
>>
>>
>> _____________________________________
>> 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
More information about the Insight-users
mailing list