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