X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=92463226aa392cb2bbd719dea9558e00eac8bc73;hb=cd0855ee735b788059c5059e5a3a533975d3cc89;hp=cc5662bb23c176288fbde36af6d41064995f4bc8;hpb=de86d2ca5f5796d0e198d0342c857af84e7df0f6;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index cc5662b..9246322 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -90,10 +90,10 @@ vvSlicer::vvSlicer() 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; @@ -708,17 +708,18 @@ void vvSlicer::SetVFLog(int log) void vvSlicer::SetTSlice(int t) { if (t < 0) - t = 0; + mCurrentTSlice = 0; else if ((unsigned int)t >= mImage->GetVTKImages().size()) - t = mImage->GetVTKImages().size() -1; + mCurrentTSlice = mImage->GetVTKImages().size() -1; + else + mCurrentTSlice = t; // Update transform mConcatenatedTransform->Identity(); - mConcatenatedTransform->Concatenate(mImage->GetTransform()[t]); + mConcatenatedTransform->Concatenate(mImage->GetTransform()[mCurrentTSlice]); mConcatenatedTransform->Concatenate(mSlicingTransform); // Update image data - mCurrentTSlice = t; mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] ); if (mVF && mVFActor->GetVisibility()) { if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice) @@ -762,6 +763,18 @@ int vvSlicer::GetTSlice() } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +int vvSlicer::GetMaxCurrentTSlice() +{ + int t = mCurrentTSlice; + if(mOverlay) + t = std::max(t, mCurrentOverlayTSlice); + if(mFusion) + t = std::max(t, mCurrentFusionTSlice); + return t; +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ int vvSlicer::GetFusionTSlice() { @@ -800,15 +813,22 @@ void vvSlicer::SetSliceOrientation(int orientation) AdjustResliceToSliceOrientation(mOverlayReslice); // Update the viewer - int *range = this->GetSliceRange(); - if (range) - this->Slice = static_cast((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(sCursor); + } + +// int *range = this->GetSliceRange(); +// if (range) +// this->Slice = static_cast((range[0] + range[1]) * 0.5); + this->UpdateOrientation(); this->UpdateDisplayExtent(); @@ -1467,6 +1487,14 @@ void vvSlicer::SetSlice(int slice) } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +int vvSlicer::GetTMax() { + int tmax = (int)mImage->GetVTKImages().size() - 1; + if(mOverlay) + tmax = std::max(tmax, (int)mOverlay->GetVTKImages().size()-1); + return tmax; +} +//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void vvSlicer::SetContourSlice()