[vtkusers] How to change pixel color?

Mark Wyszomierski markww at gmail.com
Fri May 16 15:35:05 EDT 2008


>>  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 <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 <markww at gmail.com>:
>
>> 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 <yenanqu at scs.fsu.edu> wrote:
>>> Did you retrieve pixel data from vtkImageData seccessfully?
>>>
>>>
>>> Yenan
>>> Quoting Romuald BERTRAND <beromuald at wanadoo.fr>:
>>>
>>>> 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.
>
>



More information about the vtkusers mailing list