// EED MPR view orientation correction..
vtkImageFlip *flipYFilter = vtkImageFlip::New();
flipYFilter->SetFilteredAxis(1); // flip y axis
// EED MPR view orientation correction..
vtkImageFlip *flipYFilter = vtkImageFlip::New();
flipYFilter->SetFilteredAxis(1); // flip y axis
image->SetOutputSpacing( 1,1,1 );
image->CenterImageOn();
image->Update();
_imageTransform = vtkTransform::New();
vtkImageReslice *slicer =vtkImageReslice::New();
image->SetOutputSpacing( 1,1,1 );
image->CenterImageOn();
image->Update();
_imageTransform = vtkTransform::New();
vtkImageReslice *slicer =vtkImageReslice::New();
slicer->SetInformationInput( image->GetOutput() );
slicer->SetResliceTransform( _imageTransform );
slicer->SetOutputOrigin(0 , 0 , 0 );
slicer->SetInterpolationModeToNearestNeighbor();
slicer->Update();
vtkImageChangeInformation *imageResult = vtkImageChangeInformation::New();
slicer->SetInformationInput( image->GetOutput() );
slicer->SetResliceTransform( _imageTransform );
slicer->SetOutputOrigin(0 , 0 , 0 );
slicer->SetInterpolationModeToNearestNeighbor();
slicer->Update();
vtkImageChangeInformation *imageResult = vtkImageChangeInformation::New();
double spc[3];
planeWidgetY->GetResliceOutput()->GetSpacing(spc);
imageResult->SetOutputSpacing( spc[1], spc[0], spc[2] );
double spc[3];
planeWidgetY->GetResliceOutput()->GetSpacing(spc);
imageResult->SetOutputSpacing( spc[1], spc[0], spc[2] );
dim[0] = ext[1]-ext[0]+1;
dim[1] = ext[3]-ext[2]+1;
dim[2] = ext[5]-ext[4]+1;
dim[0] = ext[1]-ext[0]+1;
dim[1] = ext[3]-ext[2]+1;
dim[2] = ext[5]-ext[4]+1;
double xSpacing, ySpacing, zSpacing;
bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
double xSpacing, ySpacing, zSpacing;
bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
bbGetOutputPlaneX()->SetPlaneOrientationToXAxes();
bbGetOutputPlaneX()->SetSlicePosition((xMax+xMin)/2.*xSpacing);
bbGetOutputPlaneX()->SetPlaneOrientationToXAxes();
bbGetOutputPlaneX()->SetSlicePosition((xMax+xMin)/2.*xSpacing);
// bbGetOutputPlaneX()->SetPoint1( 0*xSpacing, 146*ySpacing, 186*zSpacing);
// bbGetOutputPlaneX()->SetPoint2( 126*xSpacing, 146*ySpacing, 0*zSpacing);
// bbGetOutputPlaneX()->SetPoint1( 0*xSpacing, 146*ySpacing, 186*zSpacing);
// bbGetOutputPlaneX()->SetPoint2( 126*xSpacing, 146*ySpacing, 0*zSpacing);
bbGetOutputPlaneY()->SetPlaneOrientationToYAxes();
bbGetOutputPlaneY()->SetSlicePosition((yMax+yMin)/2.*ySpacing);
bbGetOutputPlaneY()->SetPlaneOrientationToYAxes();
bbGetOutputPlaneY()->SetSlicePosition((yMax+yMin)/2.*ySpacing);
bbGetOutputPlaneZ()->SetPlaneOrientationToZAxes();
bbGetOutputPlaneZ()->SetSlicePosition((zMax+zMin)/2.*zSpacing);
bbGetOutputPlaneZ()->SetPlaneOrientationToZAxes();
bbGetOutputPlaneZ()->SetSlicePosition((zMax+zMin)/2.*zSpacing);
bbGetOutputPlaneX()->GetResliceOutput()->Update();
bbGetOutputPlaneY()->GetResliceOutput()->Update();
bbGetOutputPlaneZ()->GetResliceOutput()->Update();
bbGetOutputPlaneX()->GetResliceOutput()->Update();
bbGetOutputPlaneY()->GetResliceOutput()->Update();
bbGetOutputPlaneZ()->GetResliceOutput()->Update();
double xSpacing, ySpacing, zSpacing;
bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
plane3pts->SetOrigin(pointsx[0]*xSpacing,pointsy[0]*ySpacing,pointsz[0]*zSpacing);
double xSpacing, ySpacing, zSpacing;
bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
plane3pts->SetOrigin(pointsx[0]*xSpacing,pointsy[0]*ySpacing,pointsz[0]*zSpacing);
plane3pts->SetPoint2((origin[0]+vect2[0]*factor)*xSpacing,
(origin[1]+vect2[1]*factor)*ySpacing,
(origin[2]+vect2[2]*factor)*zSpacing);
plane3pts->SetPoint2((origin[0]+vect2[0]*factor)*xSpacing,
(origin[1]+vect2[1]*factor)*ySpacing,
(origin[2]+vect2[2]*factor)*zSpacing);
_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);
_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);