[vtkusers] vtkImageMapToWindowLevelColors help
Luca Pamparana
luca.pamparana at gmail.com
Tue Apr 17 11:03:41 EDT 2007
Hey Anka,
Thanks again! I am trying to see if the vtkImageActor can be accomodated
easily without changing too much of my existing code. I have finally managed
to get the vtkImageReslice give me exactly what I wanted and it would be a
shame to change it all again!
Why, oh why, does the vtkImageMapper not work like a normal filter with some
output port!! :)
Thanks,
Luca
On 4/17/07, Anka Kochanowska <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>> 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070417/0f6305b7/attachment.htm>
More information about the vtkusers
mailing list