X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=1ace5c2ee89bf3cfa6131f5c7a13263cc7fe0b52;hb=1548a47199250d3819961adb37becac65bc72f3c;hp=d3a8dec85839cc1902a004fd3a75a851b6c29887;hpb=d6a42415475f71b3d7299d722c6e80bb2f88ff57;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index d3a8dec..1ace5c2 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -474,7 +475,7 @@ bool vvSlicer::GetActorVisibility(const std::string& actor_type, int overlay_ind else if (actor_type == "overlay") { vis = this->mOverlayActor->GetVisibility(); } - else if (actor_type == "fusion") { + else if ( (actor_type == "fusion") || (actor_type == "fusionSequence") ){ vis = this->mFusionActor->GetVisibility(); } else if (actor_type == "contour") @@ -496,7 +497,7 @@ void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_ind else if (actor_type == "overlay") { this->mOverlayActor->SetVisibility(vis); } - else if (actor_type == "fusion") { + else if ( (actor_type == "fusion") || (actor_type == "fusionSequence") ){ this->mFusionActor->SetVisibility(vis); } else if (actor_type == "contour") @@ -576,36 +577,40 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) if (!mCross) mCross = vtkSmartPointer::New(); + if (!mClipBox) + mClipBox = vtkSmartPointer::New(); + if (!mLandClipper) + mLandClipper = vtkSmartPointer::New(); + if (!mLandGlyph) + mLandGlyph = vtkSmartPointer::New(); + if (!mLandMapper) + mLandMapper = vtkSmartPointer::New(); + if (!mLandActor) + mLandActor = vtkSmartPointer::New(); + mCross->SetFocalPoint(0.0,0.0,0.0); mCross->SetModelBounds(-10,10,-10,10,-10,10); mCross->AllOff(); mCross->AxesOn(); - if (!mLandGlyph) - mLandGlyph = vtkSmartPointer::New(); + mLandClipper->SetClipFunction(mClipBox); + mLandClipper->InsideOutOn(); + mLandClipper->SetInput(mLandmarks->GetOutput()); + mLandGlyph->SetSource(mCross->GetOutput()); - mLandGlyph->SetInput(landmarks->GetOutput()); + mLandGlyph->SetInput(mLandClipper->GetOutput()); //mLandGlyph->SetIndexModeToScalar(); - mLandGlyph->SetRange(0,1); - mLandGlyph->ScalingOff(); + //mLandGlyph->SetRange(0,1); + //mLandGlyph->ScalingOff(); - mLandGlyph->SetColorModeToColorByScalar(); - - if (!mClipBox) - mClipBox = vtkSmartPointer::New(); - if (!mLandClipper) - mLandClipper = vtkSmartPointer::New(); - mLandClipper->InsideOutOn(); - mLandClipper->SetInput(mLandGlyph->GetOutput()); - mLandClipper->SetClipFunction(mClipBox); + //mLandGlyph->SetColorModeToColorByScalar(); + + mLandGlyph->SetScaleModeToDataScalingOff(); + mLandGlyph->SetIndexModeToOff(); - if (!mLandMapper) - mLandMapper = vtkSmartPointer::New(); - mLandMapper->SetInputConnection(mLandClipper->GetOutputPort()); + mLandMapper->SetInputConnection(mLandGlyph->GetOutputPort()); //mLandMapper->ScalarVisibilityOff(); - if (!mLandActor) - mLandActor = vtkSmartPointer::New(); mLandActor->SetMapper(mLandMapper); mLandActor->GetProperty()->SetColor(255,10,212); mLandActor->SetPickable(0); @@ -636,7 +641,7 @@ void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index) mOverlayActor = NULL; mOverlayMapper = NULL; } - if (actor_type == "fusion") { + if ( (actor_type == "fusion") || (actor_type == "fusionSequence") ) { Renderer->RemoveActor(mFusionActor); mFusion = NULL; mFusionActor = NULL; @@ -721,6 +726,7 @@ void vvSlicer::SetTSlice(int t) if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice) mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]); } +//also temporarilly disabled... if (mOverlay && mOverlayActor->GetVisibility()) { if (mOverlay->GetVTKImages().size() > (unsigned int)t) { mCurrentOverlayTSlice = t; @@ -732,6 +738,32 @@ void vvSlicer::SetTSlice(int t) mConcatenatedOverlayTransform->Concatenate(mSlicingTransform); } } +//temporarilly disabled for testing fusionSequence + //if (mFusion && mFusionActor->GetVisibility()) { + // if (mFusion->GetVTKImages().size() > (unsigned int)t) { + // mCurrentFusionTSlice = t; + // mFusionReslice->SetInput( mFusion->GetVTKImages()[mCurrentFusionTSlice]); + + // // Update fusion transform + // mConcatenatedFusionTransform->Identity(); + // mConcatenatedFusionTransform->Concatenate(mFusion->GetTransform()[mCurrentFusionTSlice]); + // mConcatenatedFusionTransform->Concatenate(mSlicingTransform); + // } + //} + if (mSurfaceCutActors.size() > 0) + for (std::vector::iterator i=mSurfaceCutActors.begin(); + i!=mSurfaceCutActors.end(); i++) + (*i)->SetTimeSlice(mCurrentTSlice); + UpdateDisplayExtent(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvSlicer::SetFusionSequenceTSlice(int t) +{ +//QMessageBox::information(NULL, "vvSlicer::SetFusionSequenceTSlice", "ENTER, t = " + QString::number(t) + ", currentFusionTSlice = " + QString::number(mCurrentFusionTSlice)); + //fusionSequence data is stored behind standard fusion data... if (mFusion && mFusionActor->GetVisibility()) { if (mFusion->GetVTKImages().size() > (unsigned int)t) { mCurrentFusionTSlice = t; @@ -743,10 +775,7 @@ void vvSlicer::SetTSlice(int t) mConcatenatedFusionTransform->Concatenate(mSlicingTransform); } } - if (mSurfaceCutActors.size() > 0) - for (std::vector::iterator i=mSurfaceCutActors.begin(); - i!=mSurfaceCutActors.end(); i++) - (*i)->SetTimeSlice(mCurrentTSlice); + UpdateDisplayExtent(); } //------------------------------------------------------------------------------ @@ -765,8 +794,9 @@ int vvSlicer::GetMaxCurrentTSlice() int t = mCurrentTSlice; if(mOverlay) t = std::max(t, mCurrentOverlayTSlice); - if(mFusion) - t = std::max(t, mCurrentFusionTSlice); + //TODO temporarily desactivated... + //if(mFusion) + // t = std::max(t, mCurrentFusionTSlice); return t; } //------------------------------------------------------------------------------ @@ -1003,7 +1033,6 @@ void vvSlicer::UpdateDisplayExtent() } } } - } //---------------------------------------------------------------------------- @@ -1444,13 +1473,38 @@ void vvSlicer::UpdateLandmarks() { vtkPolyData *pd = static_cast(mLandClipper->GetInput()); if (pd->GetPoints()) { - mLandGlyph->SetRange(0,1); - mLandGlyph->Modified(); - mLandGlyph->Update(); + //mLandGlyph->SetRange(0,1); + //mLandGlyph->Modified(); + //mLandGlyph->Update(); mClipBox->Modified(); mLandClipper->Update(); mLandMapper->Update(); + //Let's add the captions + //First remove all captions: + for(unsigned int i=0;iRenderer->RemoveActor2D(mLandLabelActors[i]); + //allActors2D->Remove (mLandLabelActors[i]); + } + mLandLabelActors.clear(); + //Next add the captions to the displayed points + for (vtkIdType id=0; idGetOutput()->GetNumberOfPoints(); id++) { + double *position = mLandClipper->GetOutput()->GetPoint(id); + vtkStdString label = static_cast(mLandClipper->GetOutput()->GetPointData()->GetAbstractArray("labels"))->GetValue(id); + vtkSmartPointer label_actor = vtkSmartPointer::New(); + label_actor->SetCaption(label); + label_actor->SetAttachmentPoint(position); + label_actor->GetCaptionTextProperty()->SetColor(1,0,0); + label_actor->GetCaptionTextProperty()->SetOrientation(33.333333); + label_actor->GetCaptionTextProperty()->SetFontFamilyToTimes(); + label_actor->GetCaptionTextProperty()->SetBold(0); + label_actor->GetCaptionTextProperty()->SetFontSize(6); + label_actor->BorderOff(); + label_actor->LeaderOff(); + label_actor->ThreeDimensionalLeaderOff(); + mLandLabelActors.push_back(label_actor); + this->Renderer->AddActor2D(mLandLabelActors[id]); + } } }