[vtkusers] How to change pixel color?

Romuald BERTRAND beromuald at wanadoo.fr
Thu May 22 10:36:47 EDT 2008


Ok, pPix = (unsigned char*)id->GetScalarPointer(); works for me.

But I have a problem : I display a grey image (1 component) and I want to change few pixels in green (for example), I don't know how can I do this.
The grey image has 1 scalar component, and I need to transform its to 3 components, and it takes a lot of time, and it's not very interactiv.

Someone know can I do my task?

Thanks a lot for answers,

Romu

PS : yenan, make sure you change just one component if you have a grey image, and change 3 components if you have a rgb image.
 
 
 

> Message du 19/05/08 20:54
> De : yenanqu at scs.fsu.edu
> A : "Romuald BERTRAND" 
> Copie à : "Mark Wyszomierski" , vtkusers at vtk.org
> Objet : Re: [vtkusers] How to change pixel color?
> 
> No, I am still trying it. if you have other way to or could make it  
> work, please, please let me know.
> 
> Yenan
> 
> Quoting Romuald BERTRAND :
> 
> > Hi,
> >
> > Thanks for your answers.
> >
> > I have tried but pPix = (unsigned char*)id->GetScalarPointer();   
> > doesn't work for me.
> >
> > when I change the components, nothing change, and after I have   
> > display the array and I have seen it is null.
> > Know you why?
> >
> > Yenan: Have you arrived to manipulate it correctly?
> >
> > Thanks
> >
> >
> >
> >> Message du 16/05/08 21:35
> >> De : "Mark Wyszomierski"
> >> A : yenanqu at scs.fsu.edu
> >> Copie à : "Romuald BERTRAND" , vtkusers at vtk.org
> >> Objet : Re: [vtkusers] How to change pixel color?
> >>
> >> >>  pPix = (unsigned char*)id->GetScalarPointer();
> >>
> >> That should work, I've used it many times for instance in this project:
> >>
> >>       
> >> http://devsample.org/index.php?option=com_content&task=view&id=48&Itemid=27
> >>
> >> I show the value of the pixel that the mouse is over. Maybe there's
> >> something else going on in your pipeline?
> >>
> >> Mark
> >>
> >>
> >>
> >> On 5/16/08, yenanqu at scs.fsu.edu  wrote:
> >> >   How to get pointer from vtkImageData is the hardest thing,which I
> >> > still can not make it.
> >> >
> >> > //id is vtkImageData
> >> > int *uExtent = id->GetUpdateExtent();
> >> > pPix = (unsigned char*)id->GetScalarPointer(uExtent[0], uExtent[2],
> >> > uExtent[4]);
> >> >
> >> >   or
> >> >
> >> >   pPix = (unsigned char*)id->GetScalarPointer();
> >> >
> >> > the only method I could find out. It didn't work for me. try it to see
> >> > if it works for you.
> >> >
> >> > Yenan
> >> >
> >> > Quoting Mark Wyszomierski :
> >> >
> >> >> Yeah once you get a pointer to the pixel data in vtkImageData you can
> >> >> manipulate it however you want. It's just an array of values.
> >> >>
> >> >> Mark
> >> >>
> >> >> On 5/16/08, yenanqu at scs.fsu.edu  wrote:
> >> >>> Did you retrieve pixel data from vtkImageData seccessfully?
> >> >>>
> >> >>>
> >> >>> Yenan
> >> >>> Quoting Romuald BERTRAND :
> >> >>>
> >> >>>> Hi all,
> >> >>>>
> >> >>>> I have to display an image for my work. After, I have to change the
> >> >>>> color of several pixels, I don't know why. I have a vtkImageData,
> >> >>>> and I have search some methods to set the scalars of the pixels
> >> >>>> which are stored in, but I don't arrived.
> >> >>>>
> >> >>>> Someone could help me?
> >> >>>>
> >> >>>> Thanks for answers.
> >> >>>>
> >> >>>> Romuald
> >> >>>>
> >> >>>> --
> >> >>>> This message has been scanned for viruses and
> >> >>>> dangerous content by MailScanner, and is
> >> >>>> believed to be clean.
> >> >>>>
> >> >>>>
> >> >>>
> >> >>>
> >> >>>
> >> >>> ----------------------------------------------------------------
> >> >>> This message was sent using IMP, the Internet Messaging Program.
> >> >>>
> >> >>>
> >> >>> --
> >> >>> This message has been scanned for viruses and
> >> >>> dangerous content by MailScanner, and is
> >> >>> believed to be clean.
> >> >>>
> >> >>> _______________________________________________
> >> >>> This is the private VTK discussion list.
> >> >>> Please keep messages on-topic. Check the FAQ at:
> >> >>> http://www.vtk.org/Wiki/VTK_FAQ
> >> >>> Follow this link to subscribe/unsubscribe:
> >> >>> http://www.vtk.org/mailman/listinfo/vtkusers
> >> >>>
> >> >>
> >> >> --
> >> >> This message has been scanned for viruses and
> >> >> dangerous content by MailScanner, and is
> >> >> believed to be clean.
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > ----------------------------------------------------------------
> >> > This message was sent using IMP, the Internet Messaging Program.
> >> >
> >> >
> >> > --
> >> > This message has been scanned for viruses and
> >> > dangerous content by MailScanner, and is
> >> > believed to be clean.
> >> >
> >> >
> >>
> >>
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by MailScanner, and is
> > believed to be clean.
> >
> >
> 
> 
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080522/264e11e3/attachment.htm>


More information about the vtkusers mailing list