[Insight-users] ImageFilerWriter not accepting suffixs nrrd, png, jpg
Karl Diedrich
karl.diedrich at azeresearch.com
Sun Jun 23 21:36:13 EDT 2013
To register the i/o factories we registered them in source code:
#include "itkNrrdImageIOFactory.h"
itk::NrrdImageIOFactory::RegisterOneFactory();
...
typedef itk::Image<TYPE, DIM> ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
typename ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(fileName);
reader->Update();
typename ImageType::Pointer image = reader->GetOutput();
This worked for the reader but still failed when we tried to write a NRRD file.
On Fri, May 10, 2013 at 3:21 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
> If you do not use cmake, the i/o factories are not automatically
> registered.
>
> I'll have to find the doc that describes what to do.
>
> Or perhaps someone else will chime in...
>
>
> On Thu, May 9, 2013 at 4:50 PM, Karl Diedrich <
> karl.diedrich at azeresearch.com> wrote:
>
>> We are using another build system but we are calling other ITK functions
>> and they are working.
>>
>>
>>
>> On Thu, May 9, 2013 at 12:11 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>>
>>> Are you building your app with CMake? If so, does, your CMakeLists.txt
>>> file contain
>>>
>>> FIND_PACKAGE(ITK REQUIRED)
>>> INCLUDE(${ITK_USE_FILE})
>>>
>>>
>>>
>>> On Thu, May 9, 2013 at 12:05 PM, Karl Diedrich <
>>> karl.diedrich at azeresearch.com> wrote:
>>>
>>>> I was writing NRRD images with code like this in an earlier version
>>>> 3.20 of ITK
>>>>
>>>> typedef itk::Image<short, 3> ImageType;
>>>>
>>>> typedef itk::ImageFileWriter<ImageType> WriterType;
>>>>
>>>>
>>>> typename WriterType::Pointer writer = WriterType::New();
>>>>
>>>> writer->SetInput(image);
>>>>
>>>> writer->SetFileName("output.nrrd");
>>>>
>>>> try
>>>>
>>>> {
>>>>
>>>> writer->Update();
>>>>
>>>> }
>>>>
>>>> catch (itk::ExceptionObject e)
>>>>
>>>> {
>>>>
>>>> std::cerr << "Error writing file " << "output.nrrd" << e << std::endl;
>>>>
>>>> }
>>>>
>>>>
>>>> And in ITK 4.3.1 I get the error
>>>>
>>>> Error writing file output.nrrd
>>>> itk::ExceptionObject (0x7fff106e2d00)
>>>> Location: "void itk::ImageFileWriter<TInputImage>::Write() [with
>>>> TInputImage = itk::Image<short int, 2u>]"
>>>> File: ../../linux/include/ITK-4.3/itkImageFileWriter.hxx
>>>> Line: 152
>>>> Description: Could not create IO object for file centerdot.nrrd
>>>> Tried to create one of the following:
>>>> You probably failed to set a file suffix, or
>>>> set the suffix to an unsupported type.
>>>>
>>>> I also tried writing a 2D image with the filename output.png and
>>>> output.jpg but got the same error.
>>>>
>>>> Karl
>>>>
>>>>
>>>> --
>>>> Karl Diedrich, Ph.D.
>>>> Principal Engineer
>>>> ----------------------------------------
>>>> AZE Research and Development
>>>> 1 Broadway, 14th floor
>>>> Cambridge, MA 02142
>>>> Tel: +1 (617) 475-1502
>>>> http://www.azeresearch.com/ <http://www.azeofamerica.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
>>>>
>>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>
>>
>>
>> --
>> Karl Diedrich, Ph.D.
>> Principal Engineer
>> ----------------------------------------
>> AZE Research and Development
>> 1 Broadway, 14th floor
>> Cambridge, MA 02142
>> Tel: +1 (617) 475-1502
>> http://www.azeresearch.com/ <http://www.azeofamerica.com/>
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
--
Karl Diedrich, Ph.D.
Principal Engineer
----------------------------------------
AZE Technology
1 Broadway, 14th floor
Cambridge, MA 02142
Tel: +1 (617) 475-1502
http://www.azetech.com/ <http://www.azeofamerica.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130623/acf0ea40/attachment.htm>
More information about the Insight-users
mailing list