Re: [Insight-users] Write float / double images
Tomáš Kazmar
Tomash.Kazmar at seznam.cz
Tue Jan 15 15:39:05 EST 2008
Hi Olivier,
read this post: http://public.kitware.com/pipermail/insight-users/2005-August/014545.html
Although, I think TIFF6.0 supports other types, including float images, afaik there is no
support for this in ITK. So, switch to one of image types suggested in the post.
Regards,
Tomas
# ------------ Původní zpráva ------------
# Od: Olivier Tournaire <olitour at gmail.com>
# Předmět: Re: [Insight-users] Write float / double images
# Datum: 15.1.2008 16:01:22
# ----------------------------------------
# Hi,
#
# Here is the code I use (just for testing purposes on how to write an image
# with float values) :
#
# void main( int argc , char** argv )
# {
# typedef itk::Image< float, 2 > FloatImageType;
# FloatImageType::Pointer flimzge = FloatImageType::New();
#
# FloatImageType::IndexType start;
# start[0] = 0; // first index on X
# start[1] = 0; // first index on Y
# FloatImageType::SizeType size;
# size[0] = 200; // size along X
# size[1] = 200; // size along Y
#
# FloatImageType::RegionType region;
# region.SetSize( size );
# region.SetIndex( start );
#
# flimzge->SetRegions( region );
# flimzge->Allocate();
#
# FloatImageType::IndexType pixelIndex;
#
# try
# {
# //filtre->Update();
#
# for (int i=0;i<200;i++)
# {
# pixelIndex[0] = i; // x position
# for (int j=0;j<200;j++)
# {
# pixelIndex[1] = j; // y position
# flimzge->SetPixel( pixelIndex, (i-j)*4.7 );
# }
# }
#
# typedef itk::ImageFileWriter< FloatImageType > WriterType;
# WriterType::Pointer writer = WriterType::New();
# writer->SetInput(flimzge);
# writer->SetFileName( "C:\\test.tif" );
# writer->Update();
# }
# catch( itk::ExceptionObject e)
# {
# std::cout << e << std::endl;
# }
# }
#
# The exception is :
#
# itk::ExceptionObject (00F7FEF8)
# Location: "void __thiscall itk::TIFFImageIO::InternalWrite(const void *)"
# File: .\itkTIFFImageIO.cxx
# Line: 1659
# Description: itk::ERROR: TIFFImageIO(01443978): TIFF supports
# unsigned/signed char and unsigned/signed short
#
# So, the ITK TIFF writer does not support float pixels. Is there a way to
# write images with float pixels in TIFF format ?
#
# Regards,
#
# Olivier
#
# 2008/1/15, gabri <tartuz at gmail.com>:
# >
# > Hi,
# > give more information for asking an help like cut 'n paste here the
# > exception you read and the code lines you are using.
# >
# > Best reguards
# >
# > gabriele
# >
# > Olivier Tournaire ha scritto:
# > > Hi all,
# > >
# > > I am new to ITK and I tried to write a simple image of float, but it
# > > throws an exception. Is there a way to write such images ? If not,
# > > could you give me a way on how to add this functionnality ?
# > >
# > > Regards
# > >
# > > Olivier
# > > _______________________________________________
# > > Insight-users mailing list
# > > Insight-users at itk.org
# > > http://www.itk.org/mailman/listinfo/insight-users
# > >
# >
# >
# >
# >
#
#
#
More information about the Insight-users
mailing list