[Insight-users] ITK v4 + IO factory classes : runtime error

Quang Tran quangt.itbk at gmail.com
Tue Dec 13 22:27:02 EST 2011


Hi,
I also had the same problem like you. In this case you should explicit
specify the IO flag for the reader, i.e:

#include "itkPNGImageIO.h"
...
const unsigned int ImageDimension = 2;
typedef short PixelType;
typedef itk::Image<PixelType, ImageDimension> ImageType;
typedef itk::ImageFileReader<ImageType > ImageReaderType;

ImageReaderType::Pointer  pReader  = ImageReaderType::New();
pReader->SetFileName("C:\\test.png");
pReader->SetImageIO(itk::PNGImageIO::New());
pReader->Update();

/QuangT

2011/12/13 Malsoaz James <jmalsoaz at yahoo.fr>

>  Hi,
>
> I'm trying to use ITK v4. I have been able to install it successfully
> (note that the option ITK_USE_SYSTEM_GDCM doesn't work, it produce a link
> error to gdcmMSFF).
> Anyway, I built it with the internal version of GDCM.
>
> Unfortunately, when I try a reader class such as itkImageFileReader, I got
> an error regarding the IO factory classes :
> " Could not create IO object for file "C:/test.png"
>   Tried to create one of the following:
>   You probably failed to set a file suffix, or set the suffix to an
> unsupported type."
>
> As you can see, the list of IO object is empty. It seems ITK can't find
> them. I checked in the include dir and several IO files are available such
> as itkGDCMImageIO
>
> Can someone tell me what's wrong ?
>
> Regarding the CMakeLists, I created and used two variables
> - a ITK_INCLUDE_DIR (path to the include dir) to find the include files
> - a ITK_LIBRARIES list (list of path to the libs). Since the libs are not
> the same compared to ITKv3, I'm not sure which libraries to include in this
> list and in which order (if it matters), thus I listed all of them in
> alphabetical order.
>
> I have no warning/error at compilation time.
>
> I hope someone will be able to help me.
> Best
> James.
>
> _____________________________________
> 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.html
>
> 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/20111213/d4e6cc12/attachment-0001.htm>


More information about the Insight-users mailing list