mDisplayModeIsPreserveMemory = true;
SetPreserveMemoryModeEnabled(true);
mPreviousOrientation = -1;
+ mDepth = 1.0;
}
//------------------------------------------------------------------------------
clipper->SetInput(mHiddenImage->GetVTKImages()[0]);
else
clipper->SetInput(mSlicer->GetImage()->GetVTKImages()[numImage]);
+
squares->SetInput(clipper->GetOutput());
squaresMapper->SetInput(squares->GetOutput());
squaresMapper->ScalarVisibilityOff();
vtkMarchingSquares * squares,
vtkImageClip * clipper,
double threshold, int orientation, int slice) {
-
- // Set parameter for the MarchigSquare
+ // Set parameter for the MarchigSquare
squares->SetValue(0, threshold);
// Get image extent
s = s-mHiddenImage->GetFirstVTKImageData()->GetOrigin()[orientation]; // from corner second image
s = s/mHiddenImage->GetFirstVTKImageData()->GetSpacing()[orientation]; // in voxel
- if (s == floor(s)) {
- extent2[orientation*2] = extent2[orientation*2+1] = (int)floor(s);
- } else {
- extent2[orientation*2] = (int)floor(s);
- extent2[orientation*2+1] = extent2[orientation*2];
- }
+ // Rint to the closest slice
+ extent2[orientation*2+1] = extent2[orientation*2] = (int)lrint(s);
// Do not display a contour if there is no contour on this slice
- if (extent2[orientation*2+1] > extent3[orientation*2+1]) {
+ // DD(extent2[orientation*2+1]);
+ // DD(extent3[orientation*2+1]);
+ // DD(extent2[orientation*2]);
+ // DD(extent3[orientation*2]);
+ if ((extent2[orientation*2+1] > extent3[orientation*2+1]) ||
+ (extent2[orientation*2] < extent3[orientation*2])) {
actor->VisibilityOff();
return;
}
clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2],
extent2[3],extent2[4],extent2[5]);
- //std::cout << mTSlice << " " << mSlice << " " << extent2[0] << " " << extent2[1] << " " << extent2[2] << " " << extent2[3] << " " << extent2[4] << " " << extent2[5] << std::endl;
-
if (mHiddenImageIsUsed) delete extent2;
// Move the actor to be visible
double position[3] = {0, 0, 0};
- position[orientation] = -1;
+ position[orientation] = -mDepth;
actor->SetPosition(position);
-// switch (orientation) {
-// case 0:
-// actor->SetPosition(-1,0,0);
-// /*
-// // DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0]);
-// if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0] > slice) {
-// actor->SetPosition(1,0,0);
-// } else {
-// actor->SetPosition(-1,0,0);
-// }*/
-// break;
-// case 1:
-// actor->SetPosition(0,-1,0);
-// /*
-// // DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1]);
-// if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1] > slice) {
-// actor->SetPosition(0,1,0);
-// } else {
-// actor->SetPosition(0,-1,0);
-// }
-// */
-// break;
-// case 2:
-// actor->SetPosition(0,0,-1);
-// /*
-// DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2]);
-// if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2] > slice) {
-// DD("1");
-// actor->SetPosition(0,0,1);
-// } else {
-// DD("-1");
-// actor->SetPosition(0,0,-1);
-// }
-// */
-// break;
-// }
-
mapper->Update();
-
-
-
}
//------------------------------------------------------------------------------