Hello,<br><br>I'm having some trouble building a pipeline with several grayscale lookup tables by hand. Let's see if someone can help me.<br>I think may be I'm not understanding well what does exactly every method from the lookup table classes.
<br><br>The images I want to view are medical images and I'm using vtkImageViewer2. I'll show an example case to illustrate better the problems I have.<br><br>For example, I have an image whit a pixel range of -2047..+2048. Then I want to apply to that image a Lookup table. This lookup table has 4096 entries, and its values goes from 0 to 65535 with a +16 step between each entry ( 0, 16, 32, 48, ...,65519, 65535 ).
<br><br>This is the code to build the grayscale lut <br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">int numberOfEntries = 4096;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">vtkLookupTable *vtkLut = vtkLookupTable::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">vtkLut->SetNumberOfTableValues( numberOfEntries );
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">for( int i =0; i < numberOfEntries; i++ )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
{</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> double value = (double)lutValues[i]/65535.0; // lutValues is the array with the values of the lut ( 0,16,...,65535)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkLut->SetTableValue( i , value , value , value , 1.0 );</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">vtkLut->SetTableRange( -2047 , 2048 );</span><br><br>My first question about this lut is if is the correct way to build it, or if I'm missing something.
<br>Another thing I want to know is what exactly does the method SetTableRange. It refers to the range of the input values or the range for the output? I mean, the range refers to the vtkImageData object I want to apply the lut or to the range of the vtkImageData produced once I applied the lut to the original data?
<br>If i put table range to 0,65535, (that is the supposed range of the output data?), I get a dark image.<br><br>This is the code to build the pipeline<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkImageViewer2 *viewer = vtkImageViewer2::New()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">viewer->SetInput( imageData ); // image data is a vtkImageData object obtained reading a file
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">vtkImageMapToColors *mapColors = vtkImageMapToColors::New();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">mapColors->SetInput( imageData );</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">mapColors->SetLookupTable( vtkLut ); // the lut we've build before
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">// I do this because I don't want to use the internal window level mapper that vtkImageViewer2 has
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">viewer->GetImageActor()->SetInput( mapColors->GetOutput() );</span><br><br>After this first lut transform, I would like to apply a window level transform, either with another lut o the common window/level values, and after the window levelling another lut.
<br>I don't know which are the appropiate classes to expand this pipeline and how to do it well.<br><br>Does someone know which is the right way to do this?<br><br>Thanks in advance!<br><br><br><br><br><br>