+ //for the plane widgets
+ vtkImagePlaneWidget* plane3pts = (vtkImagePlaneWidget*)bbGetOutputPlane3Pts();
+ plane3pts->SetInput(bbGetInputIn());
+ double xSpacing, ySpacing, zSpacing;
+ bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
+ plane3pts->SetOrigin(pointsx[0]*xSpacing,pointsy[0]*ySpacing,pointsz[0]*zSpacing);
+ plane3pts->SetPoint1((origin[0]+newx[0]*factor)*xSpacing,
+ (origin[1]+newx[1]*factor)*ySpacing,
+ (origin[2]+newx[2]*factor)*zSpacing);
+ plane3pts->SetPoint2((origin[0]+vect2[0]*factor)*xSpacing,
+ (origin[1]+vect2[1]*factor)*ySpacing,
+ (origin[2]+vect2[2]*factor)*zSpacing);
+ plane3pts->GetResliceOutput()->Update();
+//To get the slice of image out of the selected volume
+ if (_imageReslicer==NULL){
+ _imageReslicer = vtkImageReslice::New();
+ _imageReslicer->SetOutputDimensionality(2);
+ _imageReslicer->SetInterpolationModeToLinear();
+ _transform = vtkTransform::New();
+ _matrix = vtkMatrix4x4::New();
+ }
+ _imageReslicer->SetInput( bbGetInputIn() );
+ _imageReslicer->SetInformationInput(bbGetInputIn());
+ //fill out the information with the created vectors and using the spacing of the image
+ _imageReslicer->SetResliceAxesDirectionCosines(newx[0]*xSpacing,newx[1]*xSpacing,newx[2]*xSpacing,
+ vect2[0]*ySpacing,vect2[1]*ySpacing,vect2[2]*ySpacing,
+ crossp[0]*zSpacing,crossp[1]*zSpacing,crossp[2]*zSpacing);
+ _imageReslicer->SetResliceAxesOrigin(origin[0]*xSpacing,origin[1]*ySpacing,origin[2]*zSpacing);