<p style="margin:0;padding:0;" align="left">Hi Mark, thanks for your help,<br /><br />I have tried this little algorithm :<br /><br /><em>&nbsp;&nbsp;&nbsp; //Point on the scalars<br />&nbsp;&nbsp;&nbsp; unsigned short* pPix = (unsigned short*)ima-&gt;GetScalarPointer();<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; //Search for the maximum<br />&nbsp;&nbsp;&nbsp; unsigned short max(0);<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; for( int i=0; i&lt;dimX*dimY; i++ )<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if( pPix[i] &gt; max )<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; max = pPix[i];<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; //Creating LUT<br />&nbsp;&nbsp;&nbsp; vtkLookupTable* LUT = vtkLookupTable::New();<br />&nbsp;&nbsp;&nbsp; LUT-&gt;Allocate(65536);<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; LUT-&gt;SetTableValue(max+1, 0, 255, 0); //RGB, A=1.0<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; LUT-&gt;Build();<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; //Creating iterator for the list (pN3 contains points coordinates)<br />&nbsp;&nbsp;&nbsp; list&lt;pN3&gt;::iterator it;<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; for( it = liste.begin(); it != liste.end(); it++ )<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double ptSeg[3];<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ptSeg[0] = (*it).x;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ptSeg[1] = (*it).y;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ptSeg[2] = </em><em>(*it).z</em><em>;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Search for point index<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int nVolIdx = ima-&gt;FindPoint(ptSeg);<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pPix[nVolIdx] = max+1;<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; //PROBLEM HERE<br />&nbsp;&nbsp;&nbsp; vtkActorCollection* Collec = pRenderer-&gt;GetActors();<br />&nbsp;&nbsp;&nbsp; Collec-&gt;InitTraversal();<br />&nbsp;&nbsp;&nbsp; Collec-&gt;GetNextItem()-&gt;GetMapper()-&gt;SetLookupTable(LUT);<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; Refresh();<br /></em><br />But when <em> Collec-&gt;GetNextItem()-&gt;GetMapper()-&gt;SetLookupTable(LUT); </em>the programm crashes. Do you know why? I made an error?<br /><br />Thanks for your help,<br />Bye<br /><br />Romu<br /></p> <br /> <br /> <br /><br /><blockquote style="border-left: 2px solid #ff0000; padding-left: 5px; margin-left: 5px">&gt; Message du 22/05/08 20:24<br />&gt; De : &quot;Mark Wyszomierski&quot; <br />&gt; A : &quot;Romuald BERTRAND&quot; <br />&gt; Copie &agrave; : yenanqu@scs.fsu.edu, vtkusers@vtk.org<br />&gt; Objet : Re: [vtkusers] How to change pixel color?<br />&gt; <br />&gt; Yeah that's tricky because converting your original greyscale data<br />&gt; into three component color data implies you're only going to be using<br />&gt; 255 possible grey values, whereas your original grey data might be in<br />&gt; the 16 bit range etc. So, what are you going to do with a grey value<br />&gt; of say 3000? This problem occurs even when you're viewing a greyscale<br />&gt; image because you need to map the grey values into the range that the<br />&gt; monitor can display. I guess this is what window/leveling is for, so<br />&gt; you're determining some window/scale to remap all those really big<br />&gt; gray values for the user. Can anyone verify that?<br />&gt; <br />&gt; This isn't a good recommendation, but it's something I hacked together<br />&gt; just to get a temporary visualization going. If your greyscale data is<br />&gt; being stored in unsigned shorts let's say, you can iterate over all<br />&gt; the pixel data and find the max value used. For the images I worked<br />&gt; with, this was rarely near the unsigned short max value, it was<br />&gt; usually 20,000 let's say. Then if I wanted to display green pixels in<br />&gt; the volume, I would use a lookup table and add points like 20001 =<br />&gt; (0,255,0), 20002 = (255,0,0) and so on. You're sure your greyscale<br />&gt; data never uses those values. Then you replace the voxels of interest<br />&gt; with those appropriate lookup table values. When you hand the volume +<br />&gt; LUT to VTK, you'll see the voxels in the colors you chose.<br />&gt; <br />&gt; There are problems with doing that of course. One is that your LUT<br />&gt; will always have to be dynamically created which is kind of annoying.<br />&gt; You're also overwriting voxel values in the source volume, so you need<br />&gt; to keep a reference to a copy of the ones you overwrite if you want to<br />&gt; 'remember' the original greyscale values. The list goes on. But it<br />&gt; works and maybe it can give you some ideas.<br />&gt; <br />&gt; I'm sure other people have done this and they probably have better suggestions,<br />&gt; <br />&gt; Mark<br />&gt; <br />&gt; <br />&gt; On 5/22/08, Romuald BERTRAND  wrote:<br />&gt; &gt; Ok, pPix = (unsigned char*)id-&gt;GetScalarPointer(); works for me.<br />&gt; &gt;<br />&gt; &gt; But I have a problem : I display a grey image (1 component) and I want to<br />&gt; &gt; change few pixels in green (for example), I don't know how can I do this.<br />&gt; &gt; The grey image has 1 scalar component, and I need to transform its to 3<br />&gt; &gt; components, and it takes a lot of time, and it's not very interactiv.<br />&gt; &gt;<br />&gt; &gt; Someone know can I do my task?<br />&gt; &gt;<br />&gt; &gt; Thanks a lot for answers,<br />&gt; &gt;<br />&gt; &gt; Romu<br />&gt; &gt;<br />&gt; &gt; PS : yenan, make sure you change just one component if you have a grey<br />&gt; &gt; image, and change 3 components if you have a rgb image.<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt;&gt; Message du 19/05/08 20:54<br />&gt; &gt;&gt; De : yenanqu@scs.fsu.edu<br />&gt; &gt;&gt; A : &quot;Romuald BERTRAND&quot;<br />&gt; &gt;&gt; Copie &agrave; : &quot;Mark Wyszomierski&quot; , vtkusers@vtk.org<br />&gt; &gt;&gt; Objet : Re: [vtkusers] How to change pixel color?<br />&gt; &gt;&gt;<br />&gt; &gt;&gt; No, I am still trying it. if you have other way to or could make it<br />&gt; &gt;&gt; work, please, please let me know.<br />&gt; &gt;&gt;<br />&gt; &gt;&gt; Yenan<br />&gt; &gt;&gt;<br />&gt; &gt;&gt; Quoting Romuald BERTRAND :<br />&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt; Hi,<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt; Thanks for your answers.<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt; I have tried but pPix = (unsigned char*)id-&gt;GetScalarPointer();<br />&gt; &gt;&gt; &gt; doesn't work for me.<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt; when I change the components, nothing change, and after I have<br />&gt; &gt;&gt; &gt; display the array and I have seen it is null.<br />&gt; &gt;&gt; &gt; Know you why?<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt; Yenan: Have you arrived to manipulate it correctly?<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt; Thanks<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; Message du 16/05/08 21:35<br />&gt; &gt;&gt; &gt;&gt; De : &quot;Mark Wyszomierski&quot;<br />&gt; &gt;&gt; &gt;&gt; A : yenanqu@scs.fsu.edu<br />&gt; &gt;&gt; &gt;&gt; Copie &agrave; : &quot;Romuald BERTRAND&quot; , vtkusers@vtk.org<br />&gt; &gt;&gt; &gt;&gt; Objet : Re: [vtkusers] How to change pixel color?<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;  pPix = (unsigned char*)id-&gt;GetScalarPointer();<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; That should work, I've used it many times for instance in this project:<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; http://devsample.org/index.php?option=com_content&amp;task=view&amp;id=48&amp;Itemid=27<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; I show the value of the pixel that the mouse is over. Maybe there's<br />&gt; &gt;&gt; &gt;&gt; something else going on in your pipeline?<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; Mark<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; On 5/16/08, yenanqu@scs.fsu.edu  wrote:<br />&gt; &gt;&gt; &gt;&gt; &gt;   How to get pointer from vtkImageData is the hardest thing,which I<br />&gt; &gt;&gt; &gt;&gt; &gt; still can not make it.<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt; //id is vtkImageData<br />&gt; &gt;&gt; &gt;&gt; &gt; int *uExtent = id-&gt;GetUpdateExtent();<br />&gt; &gt;&gt; &gt;&gt; &gt; pPix = (unsigned char*)id-&gt;GetScalarPointer(uExtent[0], uExtent[2],<br />&gt; &gt;&gt; &gt;&gt; &gt; uExtent[4]);<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;   or<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;   pPix = (unsigned char*)id-&gt;GetScalarPointer();<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt; the only method I could find out. It didn't work for me. try it to<br />&gt; &gt;&gt; &gt;&gt; &gt; see<br />&gt; &gt;&gt; &gt;&gt; &gt; if it works for you.<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt; Yenan<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt; Quoting Mark Wyszomierski :<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; Yeah once you get a pointer to the pixel data in vtkImageData you<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; can<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; manipulate it however you want. It's just an array of values.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; Mark<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; On 5/16/08, yenanqu@scs.fsu.edu  wrote:<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Did you retrieve pixel data from vtkImageData seccessfully?<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Yenan<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Quoting Romuald BERTRAND :<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; Hi all,<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; I have to display an image for my work. After, I have to change<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; the<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; color of several pixels, I don't know why. I have a vtkImageData,<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; and I have search some methods to set the scalars of the pixels<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; which are stored in, but I don't arrived.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; Someone could help me?<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; Thanks for answers.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; Romuald<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; --<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; This message has been scanned for viruses and<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; dangerous content by MailScanner, and is<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; believed to be clean.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; ----------------------------------------------------------------<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; This message was sent using IMP, the Internet Messaging Program.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; --<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; This message has been scanned for viruses and<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; dangerous content by MailScanner, and is<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; believed to be clean.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; _______________________________________________<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; This is the private VTK discussion list.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Please keep messages on-topic. Check the FAQ at:<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; http://www.vtk.org/Wiki/VTK_FAQ<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; http://www.vtk.org/mailman/listinfo/vtkusers<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; --<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; This message has been scanned for viruses and<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; dangerous content by MailScanner, and is<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt; believed to be clean.<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt; ----------------------------------------------------------------<br />&gt; &gt;&gt; &gt;&gt; &gt; This message was sent using IMP, the Internet Messaging Program.<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt; --<br />&gt; &gt;&gt; &gt;&gt; &gt; This message has been scanned for viruses and<br />&gt; &gt;&gt; &gt;&gt; &gt; dangerous content by MailScanner, and is<br />&gt; &gt;&gt; &gt;&gt; &gt; believed to be clean.<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;&gt;<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt; --<br />&gt; &gt;&gt; &gt; This message has been scanned for viruses and<br />&gt; &gt;&gt; &gt; dangerous content by MailScanner, and is<br />&gt; &gt;&gt; &gt; believed to be clean.<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt; &gt;<br />&gt; &gt;&gt;<br />&gt; &gt;&gt;<br />&gt; &gt;&gt;<br />&gt; &gt;&gt; ----------------------------------------------------------------<br />&gt; &gt;&gt; This message was sent using IMP, the Internet Messaging Program.<br />&gt; &gt;&gt;<br />&gt; &gt;&gt;<br />&gt; &gt;&gt; --<br />&gt; &gt;&gt; This message has been scanned for viruses and<br />&gt; &gt;&gt; dangerous content by MailScanner, and is<br />&gt; &gt;&gt; believed to be clean.<br />&gt; &gt;&gt;<br />&gt; &gt;&gt;<br />&gt; &gt;&gt;<br />&gt; &gt;<br />&gt; <br />&gt; <br /></blockquote>