[Insight-users] Error in writing a file mha and mhd format

Vu Hong Thuan thuanvh at gmail.com
Fri Nov 18 22:00:36 EST 2011


It seems that the Image IO Factory does not run well.
In order to create a png image, I have to add the following code :

  typedef  itk::ImageFileWriter< ImageType  > WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetFileName(outputFilename);
  writer->SetInput(image);

  writer->SetImageIO(PNGImageIO::New()); // New Line

  writer->Update();

So, it seems complicated. :)
Thuan

2011/11/18 Vu Hong Thuan <thuanvh at gmail.com>

> Yes, I do. :) I have got 77 files .lib in the lib folder. :)
> And I build successfully the example, only get the error in the runtime.
>
>
> 2011/11/18 Bill Lorensen <bill.lorensen at gmail.com>
>
>> When you built ITKv4 did you build with all of the modules,
>> ITK_BUILD_ALL_MODULES ON?
>>
>> If you are running the examples, you should probably build all of the
>> modules.
>>
>> On Thu, Nov 17, 2011 at 8:28 PM, Vu Hong Thuan <thuanvh at gmail.com> wrote:
>> > Hi,
>> > I built the example of writing file:
>> > http://www.vtk.org/Wiki/ITK/Examples/IO/ImageFileWriter
>> > with visual C++ and I get the error of writing file png.
>> > And I think the reason that m_RegisteredFactories is not initialized
>> well?
>> > Thuan,
>> >
>> > 2011/11/18 Bill Lorensen <bill.lorensen at gmail.com>
>> >>
>> >> ITKv4 supports the writing of .mha and .mhd.
>> >>
>> >> Can you provide an example that fails?
>> >>
>> >> On Thu, Nov 17, 2011 at 4:30 AM, Vu Hong Thuan <thuanvh at gmail.com>
>> wrote:
>> >> > Hi all,
>> >> > I start to use the latest version of itk (4.0rc20). But I meet an
>> error
>> >> > in
>> >> > creating file mha or mhd format.
>> >> > Description:  Could not create IO object for file
>> >> > outputImageBsplineFine.mhd
>> >> >   Tried to create one of the following:
>> >> >   You probably failed to set a file suffix, or
>> >> >     set the suffix to an unsupported type.
>> >> > I think this is bug of itk. Do you support the writing .mha or .mhd
>> >> > format
>> >> > in this version?
>> >> > Thanks.
>> >> > Thuan.
>> >> > _____________________________________
>> >> > 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
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Unpaid intern in BillsBasement at noware dot com
>> >
>> >
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111119/55b18d5f/attachment.htm>


More information about the Insight-users mailing list