//------------------------------------------------------------------------------
void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax)
{
- int position = int((min+max)/2);
+ //int position = int((min+max)/2);
+ int position = mSlicerManagers[mCurrentPickedImageIndex]->GetSlicer(slicer)->GetSlice();
if (slicer == 0) {
- NOVerticalSlider->setValue(position);
NOVerticalSlider->setRange(min,max);
NOHorizontalSlider->setRange(tmin,tmax);
+ NOVerticalSlider->setValue(position);
} else if (slicer == 1) {
- NEVerticalSlider->setValue(position);
NEVerticalSlider->setRange(min,max);
NEHorizontalSlider->setRange(tmin,tmax);
+ NEVerticalSlider->setValue(position);
} else if (slicer == 2) {
- SOVerticalSlider->setValue(position);
SOVerticalSlider->setRange(min,max);
SOHorizontalSlider->setRange(tmin,tmax);
+ SOVerticalSlider->setValue(position);
} else if (slicer == 3) {
- SEVerticalSlider->setValue(position);
SEVerticalSlider->setRange(min,max);
SEHorizontalSlider->setRange(tmin,tmax);
+ SEVerticalSlider->setValue(position);
}
}
//------------------------------------------------------------------------------
mCurrent[1] = -VTK_DOUBLE_MAX;
mCurrent[2] = -VTK_DOUBLE_MAX;
- mCursor[0] = -VTK_DOUBLE_MAX;
- mCursor[1] = -VTK_DOUBLE_MAX;
- mCursor[2] = -VTK_DOUBLE_MAX;
- mCursor[3] = -VTK_DOUBLE_MAX;
+ mCursor[0] = 0;//-VTK_DOUBLE_MAX;
+ mCursor[1] = 0;//-VTK_DOUBLE_MAX;
+ mCursor[2] = 0;//-VTK_DOUBLE_MAX;
+ mCursor[3] = 0;//-VTK_DOUBLE_MAX;
mSubSampling = 5;
mScale = 1;
AdjustResliceToSliceOrientation(mOverlayReslice);
// Update the viewer
- int *range = this->GetSliceRange();
- if (range)
- this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
-
+
// Go to current cursor position
// double* cursorPos = GetCursorPosition();
// DDV(cursorPos, 3);
// SetCurrentPosition(cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
+ if (this->Renderer && this->GetInput()) {
+ double s = mCursor[orientation];
+ double sCursor = (s - this->GetInput()->GetOrigin()[orientation])/this->GetInput()->GetSpacing()[orientation];
+ this->Slice = static_cast<int>(sCursor);
+ }
+
+// int *range = this->GetSliceRange();
+// if (range)
+// this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
+
this->UpdateOrientation();
this->UpdateDisplayExtent();