[Insight-users] problem drawing a line into image with setPixel and write it to HD

Luis Ibanez luis.ibanez at kitware.com
Sun Jun 18 16:18:27 EDT 2006


Hi Andre,

The "image" that you are tyring to write lines into,
did you get it using a reader ?

maybe as reader->GetOutput() ?

In that case, you don't have the right to write in
such image because it belongs to the reader.

If you want to modify the image you should first remove
it from the reader. For this you can use the method:

         image->DisconnectPipeline()

before you write the lines on it using SetPixel();


   Regards,


      Luis



----------------------------
a.bongers at mediri.com wrote:
> Hi,
> 
> I've been trying to draw lines into an image using the setPixel method.
> And having some problems with writing image with the changed values to
> disk.
> 
> This is how I set the pixelvalue:
> 
>     image->SetPixel(index, value);
> 
> When I read the pixel values I set befor using
> 
>     image->GetPixel(index, value);
> 
> I can retrieve the value - so far everything seems to be O.K.
> 
> The problem occurs when I try to write the image to disk using:
> 
>    writer->SetInput(image);
>    writer->Update();
> 
> The image does not change. So I don't see the line in the image. It
> seems that when I update the writer it just uses the unmodified image.
> 
> when I repeat
>    image->GetPixel(index, value);
> after updating the writer I get the value I had before making the
> change...
> 
> Could anybody tell me what I am doing wrong ?
> Is this the correct way to draw some figures into images, or is there
> some other method ?
> Seems to be that only the value is passed to the method and not the
> reference ?!
> 
> Would be great if anybody could give me a hint...
> 
> Thanks
> 
> André
> _______________________________________________
> 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