- // DD("vvSlicer::Render");
- //DD(SliceOrientation);
- if (this->GetWindowLevel()->GetLookupTable() && !this->mOverlay && !this->mFusion)
- {
- legend->SetLookupTable(this->GetWindowLevel()->GetLookupTable());
- legend->SetVisibility(1);
- }
- else legend->SetVisibility(0);
-
- if (ca->GetVisibility())
- {
- std::string worldPos = "";
- std::stringstream world1;
- std::stringstream world2;
- std::stringstream world3;
- world1 << (int)mCurrent[0];
- world2 << (int)mCurrent[1];
- world3 << (int)mCurrent[2];
- double X = (mCurrent[0] - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
- double Y = (mCurrent[1] - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
- double Z = (mCurrent[2] - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
-
- if (pdmA->GetVisibility())
- {
- double x = mCursor[0];
- double y = mCursor[1];
- double z = mCursor[2];
- double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
- double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
- double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
-
- if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0] &&
- xCursor < this->GetImageActor()->GetDisplayExtent()[1]+1 &&
- yCursor >= this->GetImageActor()->GetDisplayExtent()[2] &&
- yCursor < this->GetImageActor()->GetDisplayExtent()[3]+1 &&
- zCursor >= this->GetImageActor()->GetDisplayExtent()[4] &&
- zCursor < this->GetImageActor()->GetDisplayExtent()[5]+1 )
- {
- vtkRenderer * renderer = this->Renderer;
-
- renderer->WorldToView(x,y,z);
- renderer->ViewToNormalizedViewport(x,y,z);
- renderer->NormalizedViewportToViewport(x,y);
- renderer->ViewportToNormalizedDisplay(x,y);
- renderer->NormalizedDisplayToDisplay(x,y);
- crossCursor->SetFocalPoint(x,y,z);
- }
- else
- crossCursor->SetFocalPoint(-1,-1,z);
- }
-
- if (X >= this->GetInput()->GetWholeExtent()[0] &&
- X <= this->GetInput()->GetWholeExtent()[1] &&
- Y >= this->GetInput()->GetWholeExtent()[2] &&
- Y <= this->GetInput()->GetWholeExtent()[3] &&
- Z >= this->GetInput()->GetWholeExtent()[4] &&
- Z <= this->GetInput()->GetWholeExtent()[5])
- {
- std::stringstream pixel1;
- std::stringstream pixel2;
- std::stringstream pixel3;
- std::stringstream temps;
- pixel1 << (int)X;
- pixel2 << (int)Y;
- pixel3 << (int)Z;
- temps << mCurrentTSlice;
- double value = this->GetInput()->GetScalarComponentAsDouble(lrint(X),
- lrint(Y),
- lrint(Z),0);
-
- std::stringstream val;
- val << value;
- worldPos += "data value : " + val.str();
- worldPos += "\n mm : " + world1.str() + " " + world2.str() + " " +
- world3.str() + " " + temps.str();
- worldPos += "\n pixel : " + pixel1.str() + " " + pixel2.str() + " " +
- pixel3.str() + " " + temps.str();
- }
- ca->SetText(1,worldPos.c_str());
+ if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
+ legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
+ legend->UseOpacityOn();
+ legend->SetVisibility(1);
+ }
+ else if (this->GetWindowLevel()->GetLookupTable() && !this->mOverlay) {
+ legend->SetLookupTable(this->GetWindowLevel()->GetLookupTable());
+ legend->UseOpacityOff();
+ legend->SetVisibility(1);
+ } else legend->SetVisibility(0);
+
+ if (ca->GetVisibility()) {
+ std::stringstream worldPos;
+ double pt[3];
+ mConcatenatedTransform->TransformPoint(mCurrent, pt);
+ double X = (pt[0] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[0])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[0];
+ double Y = (pt[1] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[1])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[1];
+ double Z = (pt[2] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[2])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[2];
+
+ if (X >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[0]-0.5 &&
+ X <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[1]+0.5 &&
+ Y >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[2]-0.5 &&
+ Y <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[3]+0.5 &&
+ Z >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[4]-0.5 &&
+ Z <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[5]+0.5) {
+
+
+ int ix, iy, iz;
+ double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mCurrentTSlice], X, Y, Z, ix, iy, iz);
+
+ if(ImageActor->GetVisibility())
+ worldPos << "data value : " << value << std::endl;
+
+ worldPos << "mm : " << lrint(mCurrentBeforeSlicingTransform[0]) << ' '
+ << lrint(mCurrentBeforeSlicingTransform[1]) << ' '
+ << lrint(mCurrentBeforeSlicingTransform[2]) << ' '
+ << mCurrentTSlice
+ << std::endl;
+ worldPos << "pixel : " << ix << ' '
+ << iy << ' '
+ << iz << ' '
+ << mCurrentTSlice
+ << std::endl;