There is no error. The problem is I cant see the final image.:-)<div>The output image does not have to be a dicom image.</div><div><br></div><div><br><div class="gmail_quote">2009/5/4 Mathieu Malaterre <span dir="ltr"><<a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">What is the error message ? I am guessing something like:<br>
<br>
"A Floating point buffer was passed but the stored pixel type was<br>
not specified." "This is currently not supported"<br>
<br>
I do not know of any DICOM Media Storage class that can store floating<br>
point data. If you are dealing with CT Image Storage Class, you can<br>
define the Rescale Slope / Intercept to use so that your 32bits<br>
floating point is stored as a 16bits integer type with an appropriate<br>
linear function (floating point parameters).<br>
<br>
2cts<br>
<br>
2009/5/3 Selim Hasan <<a href="mailto:selimhasan@gmail.com">selimhasan@gmail.com</a>>:<br>
<div><div></div><div class="h5">> Hi again,<br>
><br>
> I added the function that i use to make float number a volume. I tested<br>
> this code with adding only one pixel value, but it didnt work.<br>
> I cant also write as dicom image, this functions works without error if i<br>
> change the final image to .vtk but I can not see anything in the image.<br>
> Can someone help me to solve this problem.<br>
> typedef itk::GDCMImageIO ImageIOType;<br>
> ImageIOType::Pointer gdcmImageIO = ImageIOType::New();<br>
> typedef itk::Image< float, 3 > ImageType;<br>
> typedef itk::ImageFileWriter< ImageType > WriterType;<br>
> ImageType::Pointer image = ImageType::New();<br>
> WriterType::Pointer writer = WriterType::New();<br>
> cout<<"MakeImage"<<endl;<br>
> ImageType::IndexType start;<br>
> ImageType::SizeType size;<br>
> size[0] = 144; // size along X<br>
> size[1] = 144; // size along Y<br>
> size[2] = 60; // size along Z<br>
> start[0] = 0; // first index on X<br>
> start[1] = 0; // first index on Y<br>
> start[2] = 0; // first index on Z<br>
> ImageType::RegionType region;<br>
> region.SetSize( size );<br>
> region.SetIndex( start );<br>
> image->SetRegions( region );<br>
> image->Allocate();<br>
> ImageType::PixelType initialValue = 0;<br>
> image->FillBuffer( initialValue );<br>
> cout<<"MakeImage"<<endl;<br>
> ImageType::PixelType pixelValue;<br>
> ImageType::IndexType pixelIndex;<br>
><br>
> pixelIndex[0] = 27; // x position<br>
> pixelIndex[1] = 29; // y position<br>
> pixelIndex[2] = 37; // z position<br>
> pixelValue=0.52356; // TEST<br>
> image->SetPixel( pixelIndex, pixelValue );<br>
> cout<<"MakeImage"<<endl;<br>
> writer->SetInput(image);<br>
> writer->SetImageIO(gdcmImageIO);<br>
> writer->SetFileName("C:\\selimmingwinput\\test.dcm");<br>
> try<br>
> {<br>
> writer->Update();<br>
> }<br>
> catch( itk::ExceptionObject & e )<br>
> {<br>
> std::cerr << "WRITER UPDATE ERROR" << std::endl;<br>
> std::cerr << e << std::endl;<br>
><br>
> }<br>
> On Thu, Apr 30, 2009 at 11:19 PM, C.Cagatay Bilgin <<a href="mailto:bilgic@cs.rpi.edu">bilgic@cs.rpi.edu</a>><br>
> wrote:<br>
>><br>
>> Merhaba Selim,<br>
>> follow " 4.1.1 Creating an Image " Software manual to create an image.<br>
>> Then iterate on the image you just created and follow 4.1.3 Accessing<br>
>> Pixel Data<br>
>> to write the pixel values you read from the text file. Make sure the<br>
>> spacing<br>
>> values and the order you iterate (row,col,depth vs col,row,depth...)are<br>
>> consistent<br>
>> with the given input.<br>
>> Regards,<br>
>> C. Cagatay Bilgin<br>
>> On Apr 30, 2009, at 3:04 AM, Selim Hasan wrote:<br>
>><br>
>> Hello all,<br>
>><br>
>> I have a problem for writing an image(3D). I have an 144*144*60 values<br>
>> inside a 3-D image, those values are writen in a txt file.<br>
>><br>
>> I need to write a program that takes this .txt fýle as an input and writes<br>
>> the volume basically having the same image again. This input comes from an<br>
>> another software.<br>
>><br>
>> Does anyone know how to write this to an image?<br>
>> Thank You<br>
>> --<br>
>> Selim Hasan<br>
>><br>
>> Yeditepe University<br>
>> Computer Science Engineering<br>
>><br>
>> <a href="mailto:selimhasan@gmail.com">selimhasan@gmail.com</a><br>
>> _____________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the ITK FAQ at:<br>
>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Selim Hasan<br>
><br>
> Yeditepe University<br>
> Computer Science Engineering<br>
><br>
> <a href="mailto:selimhasan@gmail.com">selimhasan@gmail.com</a><br>
><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
</div></div><font color="#888888">Mathieu<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Selim Hasan<br><br>Yeditepe University<br>Computer Science Engineering<br><br><a href="mailto:selimhasan@gmail.com">selimhasan@gmail.com</a><br>
</div>