Page MenuHomePhabricator

ExtractDirectedPlaneImageFilterNew might have a 0.5 offset
Closed, WontfixPublic

Description

When extracting a 2D Plane with the filter, using the geometry of an renderwindow, the resulting plane is slightly dislocated. e.g. When i extract a normal transversal slice from Pic3D, the image is moved to lower left and on the upper right a "border" is created (See attached image). This also happens when i extract some rotated plane.

I used the following code to extract the slice:

mitk::Image::Pointer image; 
for (int i=0; i<this->GetDataManagerSelection().size(); i++)
{
   mitk::DataNode::Pointer node = this->GetDataManagerSelection().at(i);
   image = dynamic_cast<mitk::Image *>( node->GetData());      
}
   
// Cut plane and store in vector
mitk::ExtractDirectedPlaneImageFilterNew::Pointer extractFilter = mitk::ExtractDirectedPlaneImageFilterNew::New();
extractFilter->SetInput(image);
extractFilter->SetActualInputTimestep( 0 );
extractFilter->SetCurrentWorldGeometry2D( this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetSliceNavigationController()->GetCurrentPlaneGeometry() );
extractFilter->Modified();
extractFilter->Update();
mitk::Image::Pointer image2D = extractFilter->GetOutput();

mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(image2D);
GetDataStorage()->Add(node);

in mitkExtractDirectedPlaneImageFilterNew.cpp line 120
it says

Point3D origin = m_CurrentWorldGeometry2D->GetOrigin();

but when i change it to

Point3D origin = m_CurrentWorldGeometry2D->GetOrigin() - (m_CurrentWorldGeometry2D->GetSpacing() * 0.5) ;

everything works fine. I can extract a arbitary rotated slice. So the issue is a 0.5 offset. However, the 3D interpolation is not working so nicely anymore, when i do this.

What do you think, Andreas?
Should I change that line and you adapt the 3D interpolation? Or is the PlaneExtraction working as it should and i am just using it worng (maybe i should prepare the input geometry a little first..)

pic3d_extracted.png (630×625 px, 78 KB)

Event Timeline

Now we have the new ExtractSliceFilter. If you use this one does the error still occur?

I can confirm this issue. It still happens on 2012.12 and 2013.03.

kislinsk claimed this task.
kislinsk added a subscriber: kislinsk.
This task was automatically closed because it wasn't updated at least since July 2016 (over 2 years). Please re-open this task if you think that it is still relevant. This most probably means that you will resolve it.