- bbSetOutputPlaneX(0);
- bbSetOutputPlaneY(0);
- bbSetOutputPlaneZ(0);
- bbSetOutputImageX(0);
- bbSetOutputImageY(0);
- bbSetOutputImageZ(0);
- bbSetInputIn(0);
+ bbSetOutputPlaneX(NULL);
+ bbSetOutputPlaneY(NULL);
+ bbSetOutputPlaneZ(NULL);
+ bbSetOutputImageX(NULL);
+ bbSetOutputImageY(NULL);
+ bbSetOutputImageZ(NULL);
+ bbSetInputIn(NULL);
// 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] );
mVtkCallback = VtkCallbackType::New();
mVtkCallback->SetBlackBox(this);
planeWidgetX->AddObserver(vtkCommand::InteractionEvent,mVtkCallback);
mVtkCallback = VtkCallbackType::New();
mVtkCallback->SetBlackBox(this);
planeWidgetX->AddObserver(vtkCommand::InteractionEvent,mVtkCallback);
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();
- origin[0] = pointsx[0];
- origin[1] = pointsy[0];
- origin[2] = pointsz[0];
+ origin[0] = pointsx[0];
+ origin[1] = pointsy[0];
+ origin[2] = pointsz[0];
- point1[0] = pointsx[1];
- point1[1] = pointsy[1];
- point1[2] = pointsz[1];
+ point1[0] = pointsx[1];
+ point1[1] = pointsy[1];
+ point1[2] = pointsz[1];
- double* vect1= getNormal(makeVector(origin, point1));
- double* vect2= getNormal(makeVector(origin, point2));
- double* crossp = getCrossProduct(vect1, vect2);
+ double* vect1 = getNormal(makeVector(origin, point1));
+ double* vect2 = getNormal(makeVector(origin, point2));
+ double* crossp = getCrossProduct(vect1, vect2);
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 = vtkImageReslice::New();
_imageReslicer->SetOutputDimensionality(2);
_transform = vtkTransform::New();
_matrix = vtkMatrix4x4::New();
_imageReslicer = vtkImageReslice::New();
_imageReslicer->SetOutputDimensionality(2);
_transform = vtkTransform::New();
_matrix = vtkMatrix4x4::New();
_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);
- void ImagePlanes::updateInteractor(){
-
- vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
-
- if(interactor){
- bbGetOutputPlaneX()->SetInteractor(interactor);
- bbGetOutputPlaneX()->EnabledOn();
- bbGetOutputPlaneY()->SetInteractor(interactor);
- bbGetOutputPlaneY()->EnabledOn();
- bbGetOutputPlaneZ()->SetInteractor(interactor);
- bbGetOutputPlaneZ()->EnabledOn();
- bbGetOutputPlane3Pts()->SetInteractor(interactor);
- bbGetOutputPlane3Pts()->EnabledOn();
- }
- }
+ void ImagePlanes::updateInteractor()
+ {
+ vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
+ if(interactor)
+ {
+ bbGetOutputPlaneX()->SetInteractor(interactor);
+ bbGetOutputPlaneX()->EnabledOn();
+ bbGetOutputPlaneY()->SetInteractor(interactor);
+ bbGetOutputPlaneY()->EnabledOn();
+ bbGetOutputPlaneZ()->SetInteractor(interactor);
+ bbGetOutputPlaneZ()->EnabledOn();
+ bbGetOutputPlane3Pts()->SetInteractor(interactor);
+ bbGetOutputPlane3Pts()->EnabledOn();
+ } // if
+ }
+