[ITK-users] [ITK] Question about ImageFileReader

Bill Lorensen bill.lorensen at gmail.com
Thu Mar 27 18:05:35 EDT 2014


Actually, I'm not sure that works anymore...


On Thu, Mar 27, 2014 at 3:01 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> If you don't use cmake, you can do the following to register the factories:
>
> In order to register them define this variable
> (ITK_IO_FACTORY_REGISTER_MANAGER) before you
> includeitkImageFileReader.h file. This will register all the different
> IOs and then you can use them.
>
>  #define ITK_IO_FACTORY_REGISTER_MANAGER
>  #include <itkImageFileReader.h>
>
> In your include path please make sure to set the path to the file
> itkImageIOFactoryRegisterManager.h
>
>  itk\Modules\IO\ImageBase\include
>
>
> On Thu, Mar 27, 2014 at 12:26 PM, Matt McCormick
> <matt.mccormick at kitware.com> wrote:
>> Hi Tim,
>>
>> If CMake is used to generate the project (either XCode projects or
>> Makefiles), it will generate a little code that is linked into your
>> executable that automatically does the factory registration.
>>
>> XCode is much slower, but if your experience was with building a huge
>> project like ITK, it will be a relatively small difference when
>> building a small project that links against ITK.
>>
>> HTH,
>> Matt
>>
>> On Thu, Mar 27, 2014 at 12:45 PM, Tim Allman <dr.tim.allman at gmail.com> wrote:
>>> Matt,
>>>
>>> I don't see the link between your two sentences. Are you telling me that
>>> using Makefiles produces a different result?
>>>
>>> I tried using CMake derived Xcode projects but the result was a very(!) slow
>>> build.
>>>
>>> Thanks,
>>> Tim
>>>
>>>
>>> On 14-03-27 12:05 PM, Matt McCormick wrote:
>>>>
>>>> Hi Tim,
>>>>
>>>> CMake can generate XCode projects.  Otherwise, the ImageIO factories
>>>> will need to be registered with, e.g.
>>>>
>>>>    itk::JPEGImageIOFactory::RegisterOneFactory();
>>>>
>>>> HTH,
>>>> Matt
>>>>
>>>> On Thu, Mar 27, 2014 at 11:51 AM, Tim Allman <dr.tim.allman at gmail.com>
>>>> wrote:
>>>>>
>>>>> No I'm not. I'm working on a Mac :-( and using Xcode. However, the ITK
>>>>> libraries were built with CMake. Because I have to support both 32 and 64
>>>>> bit I used lipo to create universal static libraries but that is the only
>>>>> difference between what I am doing and a standard build.
>>>>>
>>>>>
>>>>> On 14-03-27 11:33 AM, Bill Lorensen wrote:
>>>>>
>>>>> Are using CMake to configure your program?
>>>>>
>>>>> On Mar 27, 2014 11:23 AM, "Tim Allman" <dr.tim.allman at gmail.com> wrote:
>>>>>>
>>>>>> Perhaps I misunderstand the documentation but I have written the
>>>>>> following
>>>>>> code with the idea that I could read arbitrary image file types and let
>>>>>> the
>>>>>> ImageFileReader instance figure out which ImageIO was needed. The files
>>>>>> are
>>>>>> Nrrd which seems to be supported but the last line fails with the error
>>>>>> below.
>>>>>>
>>>>>> Any suggestions?
>>>>>>
>>>>>>       std::string name =
>>>>>> /Users/tim/devel/ConvertToDicom/Case005/out_000.nrrd
>>>>>>
>>>>>>      typedef unsigned short PixelType;
>>>>>>      typedef itk::Image<PixelType, 2u> Image2DType;
>>>>>>      typedef itk::ImageFileReader<Image2DType> ReaderType;
>>>>>>
>>>>>>      ReaderType::Pointer reader = ReaderType::New();
>>>>>>      reader->SetFileName(name);
>>>>>>      reader->Update();
>>>>>>
>>>>>> itk::ImageFileReaderException:
>>>>>>
>>>>>> /Users/tim/usr/local/ITK/Universal/Debug/include/ITK-4.5/itkImageFileReader.hxx:143:
>>>>>>   Could not create IO object for file
>>>>>> /Users/tim/devel/ConvertToDicom/Case005/out_000.nrrd
>>>>>>    Tried to create one of the following:
>>>>>>    You probably failed to set a file suffix, or
>>>>>>      set the suffix to an unsupported type.
>>>>>>
>>>>>> Thanks,
>>>>>> Tim
>>>>>>
>>>>>> --
>>>>>> 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
>>>>>>
>>>>> --
>>>>> 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
>>>>>
>>>>> _______________________________________________
>>>>> Community mailing list
>>>>> Community at itk.org
>>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>>>>
>>>
>>> --
>>> Tim Allman, Ph.D.
>>> 35 Margaret Street,
>>> Guelph Ontario N1E 5R6
>>> Canada
>>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the Insight-users mailing list