Hi,<br><br>Here is the code I use (just for testing purposes on how to write an image with float values) :<br><br>void main( int argc , char** argv )<br>{<br> typedef itk::Image< float, 2 > FloatImageType;<br> FloatImageType::Pointer flimzge = FloatImageType::New();
<br><br> FloatImageType::IndexType start;<br> start[0] = 0; // first index on X<br> start[1] = 0; // first index on Y<br> FloatImageType::SizeType size;<br> size[0] = 200; // size along X<br> size[1] = 200; // size along Y
<br><br> FloatImageType::RegionType region;<br> region.SetSize( size );<br> region.SetIndex( start );<br><br> flimzge->SetRegions( region );<br> flimzge->Allocate();<br><br> FloatImageType::IndexType pixelIndex;
<br><br> try<br> {<br> //filtre->Update();<br> <br> for (int i=0;i<200;i++)<br> {<br> pixelIndex[0] = i; // x position<br> for (int j=0;j<200;j++)<br> {
<br> pixelIndex[1] = j; // y position<br> flimzge->SetPixel( pixelIndex, (i-j)*4.7 );<br> }<br> }<br><br> typedef itk::ImageFileWriter< FloatImageType > WriterType;
<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetInput(flimzge);<br> writer->SetFileName( "C:\\test.tif" );<br> writer->Update();<br> }<br> catch( itk::ExceptionObject e)
<br> {<br> std::cout << e << std::endl;<br> }<br>}<br><br>The exception is :<br><br>itk::ExceptionObject (00F7FEF8)<br>Location: "void __thiscall itk::TIFFImageIO::InternalWrite(const void *)"
<br>File: .\itkTIFFImageIO.cxx<br>Line: 1659<br>Description: itk::ERROR: TIFFImageIO(01443978): TIFF supports unsigned/signed char and unsigned/signed short<br><br>So, the ITK TIFF writer does not support float pixels. Is there a way to write images with float pixels in TIFF format ?
<br><br>Regards,<br><br>Olivier<br><br><div><span class="gmail_quote">2008/1/15, gabri <<a href="mailto:tartuz@gmail.com">tartuz@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>give more information for asking an help like cut 'n paste here the<br>exception you read and the code lines you are using.<br><br>Best reguards<br><br>gabriele<br><br>Olivier Tournaire ha scritto:<br>> Hi all,
<br>><br>> I am new to ITK and I tried to write a simple image of float, but it<br>> throws an exception. Is there a way to write such images ? If not,<br>> could you give me a way on how to add this functionnality ?
<br>><br>> Regards<br>><br>> Olivier<br>> _______________________________________________<br>> Insight-users mailing list<br>> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>>
<a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br>><br><br><br><br></blockquote></div><br>