X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMeshActor.cxx;h=b3d3c7f24b2b18fee32a4624d794228cdea29f3e;hb=HEAD;hp=bfc5343f62484176c130c229e6a0491b910ea441;hpb=1561fae3bf0756ba34e222cd1f189aac0087c62a;p=clitk.git diff --git a/vv/vvMeshActor.cxx b/vv/vvMeshActor.cxx index bfc5343..b3d3c7f 100644 --- a/vv/vvMeshActor.cxx +++ b/vv/vvMeshActor.cxx @@ -17,6 +17,7 @@ ===========================================================================**/ #include "vvMeshActor.h" #include "clitkCommon.h" +#include #include #include #include @@ -26,9 +27,9 @@ #include vvMeshActor::vvMeshActor() : - mCutDimension(0), mMesh(NULL), - mMarching(NULL), mMapper(NULL), - mActor(NULL), + mCutDimension(0), mMesh(ITK_NULLPTR), + mMarching(ITK_NULLPTR), mMapper(ITK_NULLPTR), + mActor(ITK_NULLPTR), mSuperpostionMode(false), mTimeSlice(0) {} @@ -45,15 +46,28 @@ void vvMeshActor::Init(vvMesh::Pointer mesh,int time_slice,vvImage::Pointer vf) mMarching=vtkMarchingSquares::New(); mTimeSlice=time_slice; - if (static_cast(time_slice)GetNumberOfMeshes()) + if (static_cast(time_slice)GetNumberOfMeshes()) { +#if VTK_MAJOR_VERSION <= 5 mMarching->SetInput(mMesh->GetMask(time_slice)); - else +#else + mMarching->SetInputData(mMesh->GetMask(time_slice)); +#endif + } else { +#if VTK_MAJOR_VERSION <= 5 mMarching->SetInput(mMesh->GetMask(0)); +#else + mMarching->SetInputData(mMesh->GetMask(0)); +#endif + } mMarching->SetValue(0,0.5); //mMarching->Update(); mMapper=vtkPolyDataMapper::New(); +#if VTK_MAJOR_VERSION <= 5 mMapper->SetInput(mMarching->GetOutput()); +#else + mMapper->SetInputConnection(mMarching->GetOutputPort()); +#endif //The following line allows to display the contour over the image //(http://www.nabble.com/What-happens-when-two-actors-are-at-the-same-depth--td23175458.html) vtkMapper::SetResolveCoincidentTopologyToPolygonOffset(); @@ -63,12 +77,13 @@ void vvMeshActor::Init(vvMesh::Pointer mesh,int time_slice,vvImage::Pointer vf) mActor->GetProperty()->EdgeVisibilityOn(); mActor->GetProperty()->SetEdgeColor(mMesh->r,mMesh->g,mMesh->b); mActor->GetProperty()->SetLineWidth(2.); + mActor->GetProperty()->SetOpacity(0.995); //in order to get VTK to turn on the alpha-blending in OpenGL } void vvMeshActor::SetCutSlice(double slice) { - DD("SetCutSlice"); - DD(slice); + //DD("SetCutSlice"); + //DD(slice); mCutSlice=slice; vtkImageData* mask; if (static_cast(mTimeSlice)GetNumberOfMasks()) @@ -96,10 +111,19 @@ void vvMeshActor::SetCutSlice(double slice) void vvMeshActor::SetTimeSlice(int time) { mTimeSlice=time; - if (static_cast(time)GetNumberOfMasks()) + if (static_cast(time)GetNumberOfMasks()) { +#if VTK_MAJOR_VERSION <= 5 mMarching->SetInput(mMesh->GetMask(time)); - else +#else + mMarching->SetInputData(mMesh->GetMask(time)); +#endif + } else { +#if VTK_MAJOR_VERSION <= 5 mMarching->SetInput(mMesh->GetMask(0)); +#else + mMarching->SetInputData(mMesh->GetMask(0)); +#endif + } SetCutSlice(mCutSlice); //We need to find the new mask cut slice, //since masks do not all have the same origin }