X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=331c236977b12d00ad9785dd5492d6aa685d479a;hb=000ac5b867a708575268c7c823db4fcbe727c2d6;hp=415d4a8f95398c8cdcd083fcbabe46f98146ce49;hpb=cb4f548b5df0172cc7fad02345d7eb3d7a4fa3aa;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 415d4a8..331c236 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -88,6 +88,7 @@ vvSlicer::vvSlicer() mSubSampling = 5; mScale = 1; mVFLog = 0; + mVFWidth = 1; std::string text = "F1 = sagital; F2 = coronal; F3 = axial\n"; text += "F5 = horizontal flip; F6 = vertical flip\n\n"; @@ -281,6 +282,26 @@ void vvSlicer::SetImage(vvImage::Pointer image) { mImage = image; this->Superclass::SetInput(image->GetVTKImages()[0]); + + // Prevent crash when reload -> change slice if outside extent + int extent[6]; + this->GetInput()->GetWholeExtent(extent); + if (SliceOrientation == 0) { + if (Slice >= extent[1]) { + Slice = (extent[1]-extent[0])/2.0; + } + } + if (SliceOrientation == 1) { + if (Slice >= extent[3]) { + Slice = (extent[3]-extent[2])/2.0; + } + } + if (SliceOrientation == 2) { + if (Slice >= extent[5]) { + Slice = (extent[5]-extent[4])/2.0; + } + } + this->UpdateDisplayExtent(); mCurrentTSlice = 0; ca->SetText(0,mFileName.c_str()); @@ -423,6 +444,7 @@ void vvSlicer::SetVF(vvImage::Pointer vf) mVFActor = vtkActor::New(); mVFActor->SetMapper(mVFMapper); mVFActor->SetPickable(0); + mVFActor->GetProperty()->SetLineWidth(mVFWidth); this->UpdateDisplayExtent(); this->GetRenderer()->AddActor(mVFActor); @@ -545,6 +567,17 @@ void vvSlicer::SetVFScale(int scale) } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvSlicer::SetVFWidth(int width) +{ + mVFWidth = width; + if (mVFActor) + mVFActor->GetProperty()->SetLineWidth(mVFWidth); + UpdateDisplayExtent(); + Render(); +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvSlicer::SetVFLog(int log) @@ -1378,7 +1411,8 @@ void vvSlicer::SetSlice(int slice) // DD("SetSlice de slicer = Render"); - this->Render(); + // Seems to work without this line + // this->Render(); } //----------------------------------------------------------------------------