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

Malsoaz James jmalsoaz at yahoo.fr
Wed Dec 14 11:33:26 EST 2011


How can I configure/register manually the IO classes from an install directory (bin/include/lib/share)?

I will have several installation of ITK (for several compilers) and I would like to avoid the use of find_package(ITK) and set manually the path to the libs/includes. Indeed, the ITK find package will not necessarely load the version I want.


Thank you
Best



________________________________
 De : Malsoaz James <jmalsoaz at yahoo.fr>
À : Quang Tran <quangt.itbk at gmail.com> 
Cc : "insight-users at itk.org" <insight-users at itk.org> 
Envoyé le : Mercredi 14 Décembre 2011 11h21
Objet : [Insight-users] Re :  ITK v4 + IO factory classes : runtime error
 

Thank you for the proposition.

Nevertheless, my goal is to use the power of ITK IO classes to avoid to set a IO object. A default one should be set depending on the input file.

Best.



________________________________
 De : Quang Tran <quangt.itbk at gmail.com>
À : Malsoaz James <jmalsoaz at yahoo.fr> 
Cc : "insight-users at itk.org" <insight-users at itk.org> 
Envoyé le : Mercredi 14 Décembre 2011 4h27
Objet : Re: [Insight-users] ITK v4 + IO factory classes : runtime error
 

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
>
>



_____________________________________
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/20111214/6c9e2172/attachment.htm>


More information about the Insight-users mailing list