X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=dd585636c5a76227817ec14cc8ded56fd548f132;hb=9c5f0e4d3d6b33e09d0413439ed7a867e3d85faa;hp=30a8f1034931e169815e884c2ada69129a72ae4c;hpb=cb4bdfed13b79735336f2e087a0b9372610aac06;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 30a8f10..dd58563 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -155,6 +155,7 @@ vvSlicer::vvSlicer() mConcatenatedTransform = vtkSmartPointer::New(); mConcatenatedFusionTransform = vtkSmartPointer::New(); mConcatenatedOverlayTransform = vtkSmartPointer::New(); + mFirstSetSliceOrientation = true; } //------------------------------------------------------------------------------ @@ -853,15 +854,17 @@ void vvSlicer::SetSliceOrientation(int orientation) // DDV(cursorPos, 3); // SetCurrentPosition(cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]); - if (this->Renderer && this->GetInput()) { + if (mFirstSetSliceOrientation) { + int *range = this->GetSliceRange(); + if (range) + this->Slice = static_cast((range[0] + range[1]) * 0.5); + mFirstSetSliceOrientation = false; + } + else 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(); @@ -1167,7 +1170,6 @@ void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw) this->SetupInteractor(rw->GetInteractor()); ca->SetImageActor(this->GetImageActor()); ca->SetWindowLevel(this->GetWindowLevel()); - ca->SetText(2, ""); ca->SetText(3, "\n"); double bounds[6]; @@ -1304,14 +1306,16 @@ double vvSlicer::GetOverlayColorLevel() //---------------------------------------------------------------------------- void vvSlicer::SetOverlayColorWindow(double window) { - mOverlayMapper->SetWindow(window); + if(mOverlayMapper) + mOverlayMapper->SetWindow(window); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void vvSlicer::SetOverlayColorLevel(double level) { - mOverlayMapper->SetLevel(level); + if(mOverlayMapper) + mOverlayMapper->SetLevel(level); } //---------------------------------------------------------------------------- @@ -1443,6 +1447,10 @@ void vvSlicer::Render() << std::endl; } ca->SetText(1,worldPos.str().c_str()); + + std::stringstream slicePos; + slicePos << "Slice: " << this->GetSlice(); + ca->SetText(2, slicePos.str().c_str()); } if (pdmA->GetVisibility()) {