]> Creatis software - clitk.git/blobdiff - common/clitkDicomRT_Contour.cxx
Corrected erroneous free when a real RECTILINEAR field is detected
[clitk.git] / common / clitkDicomRT_Contour.cxx
index 5c12802cf31bac02917995319718bbb22723cd38..6059f03b6644799d1bfff59410b17d499355e5b4 100644 (file)
@@ -25,6 +25,7 @@ clitk::DicomRT_Contour::DicomRT_Contour()
 {
   mMeshIsUpToDate = false;
   mNbOfPoints = 0;
+  mZ = -1;
 }
 //--------------------------------------------------------------------
 
@@ -53,10 +54,14 @@ bool clitk::DicomRT_Contour::Read(gdcm::SQItem * item)
   // Contour type [Contour Geometric Type]
   mType = item->GetEntryValue(0x3006,0x0042);
   // DD(mType);
-  if (mType != "CLOSED_PLANAR ") { ///WARNING to the space after the name ...
-    std::cerr << "Skip this contour : type=" << mType << std::endl;
+  if (mType != "CLOSED_PLANAR " && mType != "POINT ") { ///WARNING to the space after the name ...
+    //std::cerr << "Skip this contour : type=" << mType << std::endl;
     return false;
   }
+  if (mType == "POINT ") {
+    std::cerr << "Warning: POINT type not fully supported. (don't use GetMesh() with this!)"
+      << std::endl;
+  }
 
   // Number of points [Number of Contour Points]
   mNbOfPoints = parse_value<int>(item->GetEntryValue(0x3006,0x0046));
@@ -70,20 +75,19 @@ bool clitk::DicomRT_Contour::Read(gdcm::SQItem * item)
   mData = vtkPoints::New();
   mData->SetDataTypeToDouble();
   mData->SetNumberOfPoints(mNbOfPoints);
-  double z = -1;
   for(unsigned int i=0; i<mNbOfPoints; i++) {
     double p[3];
     p[0] = points[i*3];
     p[1] = points[i*3+1];
     p[2] = points[i*3+2];
     mData->SetPoint(i, p);
-    if (z == -1) z = p[2];
-    if (p[2] != z) {
+    if (mZ == -1) mZ = p[2];
+    if (p[2] != mZ) {
       DD(i);
       DD(p[2]);
-      DD(z);
+      DD(mZ);
       std::cout << "ERROR ! contour not in the same slice" << std::endl;
-      assert(p[2] == z);
+      assert(p[2] == mZ);
     }
   }