#include "clitkDicomRT_Contour.h"
#include <vtkCellArray.h>
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
#include "gdcmAttribute.h"
#include "gdcmItem.h"
#endif
//--------------------------------------------------------------------
+#if GDCM_MAJOR_VERSION >= 2
void clitk::DicomRT_Contour::UpdateDicomItem()
{
DD("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
DD(bb[0]);
}
+#endif
//--------------------------------------------------------------------
//--------------------------------------------------------------------
-#if GDCM_MAJOR_VERSION == 2
+#if GDCM_MAJOR_VERSION >= 2
bool clitk::DicomRT_Contour::Read(gdcm::Item * item)
{
mItem = item;
const gdcm::DataElement & contourdata = nestedds2.GetDataElement( tcontourdata );
at.SetFromDataElement( contourdata );
const double* points = at.GetValues();
-<<<<<<< Updated upstream
-<<<<<<< Updated upstream
-<<<<<<< variant A
->>>>>>> variant B
- // unsigned int npts = at.GetNumberOfValues() / 3;
-======= end
-=======
// unsigned int npts = at.GetNumberOfValues() / 3;
->>>>>>> Stashed changes
-=======
- // unsigned int npts = at.GetNumberOfValues() / 3;
->>>>>>> Stashed changes
-
assert(at.GetNumberOfValues() == static_cast<unsigned int>(mNbOfPoints)*3);
// Organize values
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) {
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) {
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+void clitk::DicomRT_Contour::SetTransformMatrix(vtkMatrix4x4* matrix)
+{
+ mTransformMatrix = matrix;
+}
+//--------------------------------------------------------------------
+
+
//--------------------------------------------------------------------
void clitk::DicomRT_Contour::ComputeMeshFromDataPoints()
{
mMesh->SetPoints(mPoints);
vtkIdType ids[2];
for (unsigned int idx=0 ; idx<mNbOfPoints ; idx++) {
+ double pointIn[4];
+ for (unsigned int j=0 ; j<3; ++j)
+ pointIn[j] = mData->GetPoint(idx)[j];
+ pointIn[3] = 1.0;
+ /*double pointOut[4];
+ 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;
}
//--------------------------------------------------------------------