I think Brad has the right theme here.

The issue is not a "user error". It is not a runtime error caused by user not 
doing something correctly.  For instance, it is not like the user forgot to 
give a filename an extension and therefore we couldn't figure out what format 
to use to write a file.

Rather, the issue is a "build error".  The developer created an executable that 
has no means to use the ITK IO factories.

So it would be good to catch this at compile time rather than runtime.

Jim



-----Original Message-----
From: Insight-developers [mailto:[email protected]] On Behalf 
Of Bradley Lowekamp
Sent: Tuesday, April 01, 2014 8:39 AM
To: Bill Lorensen
Cc: Insight Developers
Subject: Re: [ITK-dev] Missing IO factories when building without cmake

Bill,

I think including code in an exception message is a mistake. This information 
is clearly geared to some one developing an ITK program. 

I think it would be better to have a wiki page or a FAQ entry with what needs 
to be done to fix when there are no ImageIO factories registered. Then is 
exception message can just refer to that.

Also there is the case when a developer using CMake did not correctly include 
the ITK_USE_FILE, we were getting a of those issues with ITK v4.0 first came 
out.

Additionally, the user would have to register all the ImageIO, and TransformIO 
files. I have previously recommend copying the 
itkImageIOFactoryRegisterManager.h and the 
itkTransformIOFactoryRegisterManager.h files form the ITK build directory into 
the project to perform the factory registration.

So my question, I thought some of the information was already in the WIKI some 
place? Anyone know where? Also the FAQ[1]  looks unmaintained. Is this not a 
useful resource the community should help keep up to date? Is there a better 
location for this type of information?

Brad

[1] http://www.itk.org/Wiki/ITK/FAQ

On Mar 31, 2014, at 7:32 PM, Bill Lorensen <[email protected]> wrote:

> Folks,
> 
> We have recently seen a couple of users who build their ITK apps 
> without cmake. When they try to read or write images they get a 
> message like this:
> Description:  Could not create IO object for file foo.png  Tried to 
> create one of the following:
>  You probably failed to set a file suffix, or
>    set the suffix to an unsupported type.
> 
> I submitted a gerrit patch:
> http://review.source.kitware.com/#/c/14909/
> 
> to provide a better description of the exception:
> 
> Description:  Could not create IO object for writing file foo.img  
> Tried to create one of the following:
>  There are no registered IO factories. You probably built your project 
> without using cmake  You can register the IO factories you need with:
>    #include "itkXXXImageIOFactory.h"
>    itk::XXXImageIOFactory::RegisterOneFactory();
>     where XXX is e.g. Nifti, PNG, Meta...
>       #include "itkNiftImageIOFactory.h"
>       itk::NiftiImageIOFactory::RegisterOneFactory();
> _______________________________________________
> 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://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-developers

_______________________________________________
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://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-developers
_______________________________________________
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://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-developers

Reply via email to