X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=c9b50a7973ac827fa396b8ec59e16a976247ffc9;hb=686056dfe2391eed76302af43b08d30791901965;hp=f287e4d7e89e7f1de15678ba44faf3725da1c93b;hpb=c135f9b390e2750d8248db5903753b94ca549623;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index f287e4d..c9b50a7 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -1196,6 +1196,18 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max) } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, int X, double Y, double Z, int &ix, int &iy, int &iz, int component) +{ + ix = lrint(X); + iy = lrint(Y); + iz = lrint(Z); + image->SetUpdateExtent(ix, ix, iy, iy, iz, iz); + image->Update(); + return image->GetScalarComponentAsDouble(ix, iy, iz, component); +} +//---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- void vvSlicer::Render() { @@ -1248,9 +1260,9 @@ void vvSlicer::Render() Y <= this->GetInput()->GetWholeExtent()[3] && Z >= this->GetInput()->GetWholeExtent()[4] && Z <= this->GetInput()->GetWholeExtent()[5]) { - int ix = lrint(X); - int iy = lrint(Y); - int iz = lrint(Z); + int ix, iy, iz; + double value = this->GetScalarComponentAsDouble(this->GetInput(), X, Y, Z, ix, iy, iz); + std::stringstream pixel1; std::stringstream pixel2; std::stringstream pixel3; @@ -1259,9 +1271,6 @@ void vvSlicer::Render() pixel2 << iy; pixel3 << iz; temps << mCurrentTSlice; - this->GetInput()->SetUpdateExtent(ix, ix, iy, iy, iz, iz); - this->GetInput()->Update(); - double value = this->GetInput()->GetScalarComponentAsDouble(ix, iy, iz, 0); std::stringstream val; val << value;