[vtkusers] new pipeline question - origin update incorrect
dean.inglis at camris.ca
dean.inglis at camris.ca
Sat Sep 3 17:49:42 EDT 2005
I have a 2D image display object,
something like vtkImageViewer but not
iherited from vtkObject, that
maintains a vtk pipeline:
vtkImageData -> vtkImageMapToWindowLevelColors -> vtkImageActor
I have converted my application over
to the new pipeline and have encountered
some odd behavior. Upstream, a 2D image
is clipped by vtkImageClip and the ouput has its 3D origin
modified by vtkImageChangeInformation.
The display pipeline object takes the new input
but it's vtkInformation does not have the correct
modified origin (see code below). The data are
clipped and the input vtkImageData shows that its
origin has been altered but the maptowindowlevel
filter's output origin is unmodifed and hence the
vtkImageActor dsiplay bounds are incorrect.
1) Do I have to force the pipeline to reset itself uptsream
and if so how?
2) Do I have to "disconnect" the input to the windowlevelmap
and if so how?
3) how does one in general manage pipelines in vtk in
situations where one might want to disconnect and then
reconnect?
Dean
void vtkImage2DManger::SetImageInput(vtkImageData* input)
{
m_input = input
m_dataMin = m_input->GetScalarRange()[0];
m_dataMax = m_input->GetScalarRange()[1];
m_input->GetExtent(m_dataExtent);
m_input->GetOrigin(m_dataOrigin);
m_input->GetSpacing(m_dataSpacing);
/////////debugging attempt
vtkInformation* info = m_input->GetInformation();
vtkInformation* pipeinfo = m_input->GetPipelineInformation();
double spacing[3];
double origin[3];
info->Get(vtkDataObject::SPACING(), spacing);
info->Get(vtkDataObject::ORIGIN(), origin);
if ( spacing[0] != m_dataSpacing[0] || spacing[1] != m_dataSpacing[1] || spacing[2] != m_dataSpacing[2])
{
info->Set(vtkDataObject::SPACING(), spacing, 3);
if(ow){ ow->DisplayText("changing info spacing");}
}
if ( origin[0] != m_dataOrigin[0] || origin[1] != m_dataOrigin[1] || origin[2] != m_dataOrigin[2])
{
info->Set(vtkDataObject::ORIGIN(), origin, 3);
if(ow){ ow->DisplayText("changing info origin");}
}
pipeinfo->Get(vtkDataObject::SPACING(), spacing);
pipeinfo->Get(vtkDataObject::ORIGIN(), origin);
if ( spacing[0] != m_dataSpacing[0] || spacing[1] != m_dataSpacing[1] || spacing[2] != m_dataSpacing[2])
{
pipeinfo->Set(vtkDataObject::SPACING(), spacing, 3);
if(ow){ ow->DisplayText("changing info spacing");}
}
if ( origin[0] != m_dataOrigin[0] || origin[1] != m_dataOrigin[1] || origin[2] != m_dataOrigin[2])
{
pipeinfo->Set(vtkDataObject::ORIGIN(), origin, 3);
if(ow){ ow->DisplayText("changing info origin");}
}
/////////// end of debug attempt
m_WLMap->SetInput(m_input);
m_WLMap->SetLevel(m_level);
m_WLMap->SetWindow(m_window);
m_WLMap->UpdateWholeExtent();
this->ForceRender();
}
More information about the vtkusers
mailing list