[Insight-users] Change output file type
Stephen Yip
stephen.fyip1 at gmail.com
Thu Apr 1 11:30:08 EDT 2010
Hi Dan,
After changing hdr to png, the following is the feedback I get.
"This application has requested the Runtime to terminate it in an unusual
way. Please contact the application's support team for more information."
My inputs are png files. I have no idea how to change the file type of the
outputs since I am following the examples (DeformableRegistration1.cxx).
Thanks,
Stephen
On Wed, Mar 31, 2010 at 10:53 PM, Dan Mueller <dan.muel at gmail.com> wrote:
> Hi Stephen,
>
> The error may be caused because the PNG file format does not support
> your image type. What is the pixel type of your output image?
>
> As can be seen here
> http://www.itk.org/Wiki/ITK_File_Formats
> PNG supports unsigned char, unsigned short, RGB, and RGBA.
>
> If your image type is float or signed short, you will need to cast/rescale.
>
> In the future, consider posting the exact error message you receive.
> Statements like "the program won't run" are not very helpful for
> diagnosing the issue :P As shown in many of the ITK examples, you can
> print exception messages like this:
>
> try
> {
> myFilter->Update();
> }
> catch( itk::ExceptionObject & err )
> {
> std::cout << "ExceptionObject caught !" << std::endl;
> std::cout << err << std::endl;
> return EXIT_FAILURE;
> }
>
> HTH
>
> Cheers, Dan
>
> On 31 March 2010 22:46, Stephen Yip <stephen.fyip1 at gmail.com> wrote:
> > Hi,
> >
> > I know I have asked the similar question before.
> >
> > I tried to change "hdr" to "png" or some other file type. But the program
> > wouldn't run at all. I am not an expert of c++. I wonder how I may change
> > the output file in the DeformableRegistration1.cxx code.
> >
> > I did change "hdr" to "png"...the program wouldn't run...
> >
> > writer = itk::ImageFileWriter<ImageType>::New();
> > std::string ofn="fixed.hdr";
> > writer->SetFileName(ofn.c_str());
> > writer->SetInput(registrationFilter->GetFixedImage() );
> > writer->Write();
> >
> > ofn="moving.hdr";
> > itk::ImageFileWriter<ImageType>::Pointer writer2;
> > writer2 = itk::ImageFileWriter<ImageType>::New();
> >
> > Thank you,
> > stephen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100401/7a194a6c/attachment.htm>
More information about the Insight-users
mailing list