[Insight-users] Writing Image Problem

Selim Hasan selimhasan at gmail.com
Mon May 4 13:20:21 EDT 2009


There is no error. The problem is I cant see the final image.:-)The output
image does not have to be a dicom image.


2009/5/4 Mathieu Malaterre <mathieu.malaterre at gmail.com>

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



-- 
Selim Hasan

Yeditepe University
Computer Science Engineering

selimhasan at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090504/71763019/attachment-0001.htm>


More information about the Insight-users mailing list