[vtkusers] vtkImageMapToWindowLevelColors help

Anka Kochanowska anka at bic.mni.mcgill.ca
Tue Apr 17 11:23:16 EDT 2007


Hi, Luca,
My lookup table range is just 0-255 - enough for my grayscale blended 
image.  And in reality, I need it only for blending with a color image. 
Probably there are better ways, but as most of us I am learning from vtk 
code without much guiding and I can not always find the best filter or 
class to use.
I'm sorry I do not know how you should proceed.
Would you let me know when you solve it?

Anka


Luca Pamparana wrote:

> Hey ANka,
>
> Maybe my intial attempt at vtkImageMapToWindowLevelColor objects was 
> wrong.
>
> I have a question to you about the look up table. In your code:
>
>m_displayWindowLevelColorsImage->SetInput(m_displayImage->GetOutput());       
>
>m_displayWindowLevelColorsImage->SetLookupTable(lut);
>m_displayWindowLevelColorsImage->SetWindow(m_win_level[0]*scale);
>m_displayWindowLevelColorsImage->SetLevel(m_win_level[1]*scale);
>
>My input data is of type unsigned short and the data intensity values vary from 1000 to 20000.
>
>
>Now, I want to present the user with this window and to be able to set the width of this intensity window. 
>The filter will change the scalar type to unsigned char. I am wondering how I should generate this look up
>
>table so that it will cover my data.
>  
>
> Thanks,
>
> Luca
>
> On 4/17/07, *Anka Kochanowska* <anka at bic.mni.mcgill.ca 
> <mailto:anka at bic.mni.mcgill.ca>> wrote:
>
>     Ok, here is a part of my real program.
>     I would send you the whole class, but cannot do it without my boss'
>     approval.
>     Anka
>
>         vtkSmartPointer<vtkImageReslice> m_reslice;
>     ...
>             m_reslice->SetInput( m_imageData );
>             m_reslice->SetInterpolationModeToLinear( );
>             m_reslice->SetOutputExtent(0, 639, 0, 479, 0, 1);
>             m_reslice->SetOutputOrigin(0, 0, 0);
>             m_reslice->SetOutputDimensionality(2);
>             m_reslice->SetOutputSpacing(1,1,1);
>             m_reslice->SetResliceTransform( concat );
>             m_reslice->UpdateInformation();
>
>             m_displayImage = vtkSmartPointer<vtkImageShiftScale>::New();
>             m_displayImage->SetInput(m_reslice->GetOutput());
>             m_displayImage->SetScale(scale);
>             m_displayImage->SetOutputScalarTypeToUnsignedChar();
>
>             m_displayWindowLevelColorsImage =
>     vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
>
>     m_displayWindowLevelColorsImage->SetInput(m_displayImage->GetOutput());
>
>             m_displayWindowLevelColorsImage->SetLookupTable(lut);
>             m_displayWindowLevelColorsImage->SetWindow(m_win_level[0]*scale);
>             m_displayWindowLevelColorsImage->SetLevel(m_win_level[1]*scale);
>             m_mriActor->SetInput(m_displayWindowLevelColorsImage->GetOutput());
>
>             m_mriRenderer->AddViewProp( m_mriActor );
>
>     m_mriOutlineFilter->SetInput(m_displayWindowLevelColorsImage->GetOutput());
>             m_mriOutlineMapper->SetInput(
>     m_usOutlineFilter->GetOutput() );
>             m_mriRenderer->AddViewProp( m_mriOutlineActor );
>
>
>     Luca Pamparana wrote:
>
>     > Hey Anka,
>     >
>     > Thanks again for the reply.
>     >
>     > The thing is that I am using the reslicer to extract a 2D slice and
>     > just display that. All the interpolation, orientation, which
>     slice to
>     > extract etc. is controlled by the reslicer.
>     >
>     > The vtkImageActor seems to have its own corresponding methods for
>     > these operations. I am wondering if these can coexist... Only
>     one way
>     > to find out, I guess! Time for try some quick hack...
>     >
>     > Thanks,
>     > Luca.
>     >
>     > On 4/17/07, *Anka Kochanowska* < anka at bic.mni.mcgill.ca
>     <mailto:anka at bic.mni.mcgill.ca>
>     > <mailto:anka at bic.mni.mcgill.ca <mailto:anka at bic.mni.mcgill.ca>>>
>     wrote:
>     >
>     >     I am using vtkImageActor:
>     >
>     >
>     >             vtkImageActor * mriActor;
>     >     ...
>     >     ...
>     >             blendedImage->AddInput( 0, img1->GetOutput());
>     >             blendedImage->AddInput( 0,
>     >     .displayWindowLevelColorsImage->GetOutput());
>     >             blendedImage->Update();
>     >             mriActor->SetInput(blendedImage->GetOutput());
>     >             renderer->AddViewProp( mriActor );
>     >     Anka
>     >
>     >     Luca Pamparana wrote:
>     >
>     >     > Hello everyone,
>     >     >
>     >     > I am unable to get the vtkImageMapToWindowLevelColors to
>     give me an
>     >     > output :(
>     >     >
>     >     > My pipeline is as follows:
>     >     >
>     >     > // vtkImageData input to a reslicer
>     >     > this->m_slicer->SetInput(in);
>     >     >
>     >     > // pass the output of the slicer to
>     >     vtkImageMapToWindowLevelColors object
>     >     >
>     >    
>     this->m_windowLevelMapper->SetInputConnection(this->m_slicer->GetOutputPort());
>
>     >     >
>     >     >
>     >     > // Pipe the output to a vtkImageBlend object
>     >     > this->m_blender->AddInputConnection(0,
>     >     > this->m_windowLevelMapper->GetOutputPort());
>     >     >
>     >     > // Pipe output to a vtkImageMapper. This mapper is tied to the
>     >     Actor2D
>     >     > // object that is added to the renderer
>     >     > this->m_imageMapper->SetInput(this->m_blender->GetOutput());
>     >     >
>     >     > double * range = in->GetScalarRange();
>     >     > if (range)
>     >     > {
>     >     >       // this calls the ciorresponding methods on the
>     >     > vtkImageMapToWindowLevelColors object
>     >     >        this->SetColorWindow(range[1] - range[0]);
>     >     >        this->SetColorLevel(0.5 * (range[1] + range[0]));
>     >     >  }
>     >     >
>     >     > SetSlice(static_cast<int>((GetWholeZMin() +
>     GetWholeZMax()) * 0.5));
>     >     >
>     >     > My guess is that I am not setting the ColorWindow and
>     ColorLevel on
>     >     > the vtkImageMapper instance. However, I want to control
>     the color
>     >     > window and color level values independently of the mapper
>     as the
>     >     > vtkImageBlend will also have other inputs that I want to
>     control
>     >     the
>     >     > window and level values for.
>     >     >
>     >     > Any help on how I can get this to work is much appreciated.
>     >     >
>     >     > Thanks,
>     >     > Luca
>     >     >
>     >    
>     >------------------------------------------------------------------------
>     >
>     >     >
>     >     >_______________________________________________
>     >     >This is the private VTK discussion list.
>     >     >Please keep messages on-topic. Check the FAQ at:
>     >     http://www.vtk.org/Wiki/VTK_FAQ <
>     http://www.vtk.org/Wiki/VTK_FAQ>
>     >     >Follow this link to subscribe/unsubscribe:
>     >     >http://www.vtk.org/mailman/listinfo/vtkusers
>     >     >
>     >     >
>     >
>     >
>     >------------------------------------------------------------------------
>     >
>     >_______________________________________________
>     >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
>     >
>     >
>
>



More information about the vtkusers mailing list