[ITK] [ITK-users] Exception when running IO example ImageReadCastWrite in Xcode

Matt McCormick matt.mccormick at kitware.com
Sun Mar 30 09:30:40 EDT 2014


Hi Tim,

Yes, the CMake generate XCode or Makefiles are different.  With the
CMake generated project, it will create a directory in your build
directory called "ITKIOFactoryRegistration".  This contains the
generated header files that do the factory registration automatically.
 The have to be created at CMake configure time because they depend on
which ITK IO modules were enabled.

Hope this helps,
Matt

On Fri, Mar 28, 2014 at 2:29 PM, Tim Allman <dr.tim.allman at gmail.com> wrote:
> Matt,
>
> This is the issue I asked about earlier and I'm still confused about it.
> Your suggestion to add
>
>     itk::NrrdImageIOFactory::RegisterOneFactory();
>
> solved my problem (thank you) but I have written code to read and write
> images on the iMac before and have never had to do this. In those cases I
> just wrote Makefiles to do the build and the ImageIO instances were created
> automatically.
>
> What is happening here? Is the result of using CMake/Xcode different from
> using CMake/Makefiles or hand written Makefiles?
>
> Thanks,
> Tim
>
>
> On 14-03-28 11:04 AM, Matt McCormick wrote:
>>
>> Hi,
>>
>> Use CMake to generate the XCode project for the HelloWorld or
>> ImageReadCastWrite, and it will automatically generate all the
>> factories.
>>
>> Hope this helps,
>> Matt
>>
>> On Fri, Mar 28, 2014 at 9:44 AM, padillr <ramonpadilla1 at yahoo.co.uk>
>> wrote:
>>>
>>> Hi,
>>>
>>> I have successfully built ITK version 4.5.1 on OS X using cmake.
>>>
>>> The following are options that I'm passing to cmake.
>>>
>>> -DCMAKE_BUILD_TYPE=Debug \
>>> -DCMAKE_C_COMPILER=clang \
>>> -DCMAKE_CXX_COMPILER=clang++ \
>>> -DITK_USE_64BITS_IDS=Yes \
>>> -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" \
>>> -DITK_DIR=/temp/itk/build/
>>>
>>> I then created an Xcode project, imported the Hello World example, set up
>>> paths to the headers and linked to the ITK libraries that I built
>>> previously
>>> using cmake. The example built and ran successfully.
>>>
>>> Next, I tried to do the same with the ImageReadCastWrite example in IO.
>>> This
>>> also builds successfully but when I run it I get the following exception.
>>>
>>> ExceptionObject caught !
>>>
>>> itk::ImageFileWriterException (0x100304788)
>>> Location: "virtual void itk::ImageFileWriter<itk::Image<unsigned char, 2>
>>>>
>>>> ::Write() [TInputImage = itk::Image<unsigned char, 2>]"
>>>
>>> File: /temp/itk/Modules/IO/ImageBase/include/itkImageFileWriter.hxx
>>> Line: 151
>>> Description:  Could not create IO object for file
>>> /temp/itk-sample/T1_MAP.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'm using ITK for the first time. A quick investigation suggests that
>>> there
>>> are no factories being loaded. Any ideas why this may be the case?
>>>
>>> Please note that I can successfully execute ImageReadCastWrite in the bin
>>> directory that was created as part of building ITK.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://itk-insight-users.2283740.n2.nabble.com/Exception-when-running-IO-example-ImageReadCastWrite-in-Xcode-tp7585270.html
>>> Sent from the ITK Insight Users mailing list archive at Nabble.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
>>> _______________________________________________
>>> Community mailing list
>>> Community at itk.org
>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>
>> _____________________________________
>> 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
>
>
> --
> Tim Allman, Ph.D.
> 35 Margaret Street,
> Guelph Ontario N1E 5R6
> Canada
>
_____________________________________
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



More information about the Community mailing list