X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRT_Contour.cxx;h=4bd4598316a77fb1788851bade1cf883b44d3146;hb=796954f9fff960cee1599e5a8960e0f424931900;hp=a4a69dd600df11350d337434e36937e0316d5895;hpb=3d7149c5d5899df2ab6f0e0753e810b840fb9bf9;p=clitk.git diff --git a/common/clitkDicomRT_Contour.cxx b/common/clitkDicomRT_Contour.cxx index a4a69dd..4bd4598 100644 --- a/common/clitkDicomRT_Contour.cxx +++ b/common/clitkDicomRT_Contour.cxx @@ -53,6 +53,7 @@ void clitk::DicomRT_Contour::Print(std::ostream & os) const //-------------------------------------------------------------------- +#if GDCM_MAJOR_VERSION == 2 void clitk::DicomRT_Contour::UpdateDicomItem() { DD("DicomRT_Contour::UpdateDicomItem"); @@ -81,7 +82,11 @@ void clitk::DicomRT_Contour::UpdateDicomItem() double * p = mData->GetPoint(i); points[i*3] = p[0]; points[i*3+1] = p[1]; - points[i*3+2] = p[2]; +#if VTK_MAJOR_VERSION <= 5 + points[i*3+1] = p[2]; +#else + points[i*3+1] = p[2]-0.5; +#endif } // Get attribute @@ -109,6 +114,7 @@ void clitk::DicomRT_Contour::UpdateDicomItem() DD(bb[0]); } +#endif //-------------------------------------------------------------------- @@ -144,11 +150,7 @@ bool clitk::DicomRT_Contour::Read(gdcm::Item * item) const gdcm::DataElement & contourdata = nestedds2.GetDataElement( tcontourdata ); at.SetFromDataElement( contourdata ); const double* points = at.GetValues(); -<<<<<<< Updated upstream -======= // unsigned int npts = at.GetNumberOfValues() / 3; ->>>>>>> Stashed changes - assert(at.GetNumberOfValues() == static_cast(mNbOfPoints)*3); // Organize values @@ -159,7 +161,11 @@ bool clitk::DicomRT_Contour::Read(gdcm::Item * item) double p[3]; p[0] = points[i*3]; p[1] = points[i*3+1]; +#if VTK_MAJOR_VERSION <= 5 p[2] = points[i*3+2]; +#else + p[2] = points[i*3+2]+0.5; +#endif mData->SetPoint(i, p); if (mZ == -1) mZ = p[2]; if (p[2] != mZ) { @@ -206,7 +212,11 @@ bool clitk::DicomRT_Contour::Read(gdcm::SQItem * item) double p[3]; p[0] = points[i*3]; p[1] = points[i*3+1]; +#if VTK_MAJOR_VERSION <= 5 p[2] = points[i*3+2]; +#else + p[2] = points[i*3+2]+0.5; +#endif mData->SetPoint(i, p); if (mZ == -1) mZ = p[2]; if (p[2] != mZ) { @@ -243,6 +253,14 @@ void clitk::DicomRT_Contour::SetMesh(vtkPolyData * mesh) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void clitk::DicomRT_Contour::SetTransformMatrix(vtkMatrix4x4* matrix) +{ + mTransformMatrix = matrix; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- void clitk::DicomRT_Contour::ComputeMeshFromDataPoints() { @@ -253,13 +271,24 @@ void clitk::DicomRT_Contour::ComputeMeshFromDataPoints() mMesh->SetPoints(mPoints); vtkIdType ids[2]; for (unsigned int idx=0 ; idxGetPoint(idx)[j]; + pointIn[4] = 1.0; + /*mTransformMatrix->MultiplyPoint(pointIn, pointOut); + std::cout << pointOut[0] << " " << pointOut[1] << " " << pointOut[2] << " " << pointOut[3] << std::endl; + mMesh->GetPoints()->InsertNextPoint(pointOut[0], + pointOut[1], + pointOut[2]);*/ mMesh->GetPoints()->InsertNextPoint(mData->GetPoint(idx)[0], mData->GetPoint(idx)[1], mData->GetPoint(idx)[2]); + //std::cout << mData->GetPoint(idx)[0] << " " << mData->GetPoint(idx)[1] << " " << mData->GetPoint(idx)[2] << std::endl; ids[0]=idx; ids[1]=(ids[0]+1) % mNbOfPoints; //0-1,1-2,...,n-1-0 mMesh->GetLines()->InsertNextCell(2,ids); } + //std::cout << std::endl; mMeshIsUpToDate = true; } //--------------------------------------------------------------------