]> Creatis software - gdcm.git/commitdiff
gdcm::Orientation uses RefCounter
authorjpr <jpr>
Fri, 18 Nov 2005 11:42:48 +0000 (11:42 +0000)
committerjpr <jpr>
Fri, 18 Nov 2005 11:42:48 +0000 (11:42 +0000)
Example/PrintFile.cxx
Testing/TestPrintAllDocument.cxx
src/gdcmFileHelper.cxx
src/gdcmOrientation.h

index 71a2ea9c86da0f17b72d5836b491e21ffd2a0b25..3cd654f92d9b87e9a559a6f5ea57fd2c0fb105a8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PrintFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/15 10:40:45 $
-  Version:   $Revision: 1.71 $
+  Date:      $Date: 2005/11/18 11:45:34 $
+  Version:   $Revision: 1.72 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -351,22 +351,23 @@ int main(int argc, char *argv[])
       // Let's compute 'user friendly' results about 'Orientation'
       // ---------------------------------------------------------
  
-      gdcm::Orientation o;
+      gdcm::Orientation *o = gdcm::Orientation::New();
 
       if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND ||
            strImageOrientationRET     != gdcm::GDCM_UNFOUND )
       {
   
-         gdcm::OrientationType orient = o.GetOrientationType( f );
+         gdcm::OrientationType orient = o->GetOrientationType( f );
  
          std::cout << "TypeOrientation = " << orient << " (-> " 
-                   << o.GetOrientationTypeString(orient) << " )" << std::endl;
+                   << o->GetOrientationTypeString(orient) << " )" << std::endl;
       }
 
-      std::string ori = o.GetOrientation ( f );
+      std::string ori = o->GetOrientation ( f );
       if (ori != "\\" )
          std::cout << "Orientation [" << ori << "]" << std::endl;
  
+       o->gdcm::Orientation::Delete(); 
 //------------------------------
 
 
@@ -561,24 +562,26 @@ int main(int argc, char *argv[])
          // Let's compute 'user friendly' results about 'Orientation'
          // ---------------------------------------------------------
     
-         gdcm::Orientation o;
+         gdcm::Orientation *o = gdcm::Orientation::New(); 
+
 
          if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND ||
             strImageOrientationRET     != gdcm::GDCM_UNFOUND )
          {
      
-            gdcm::OrientationType orient = o.GetOrientationType( f );
+            gdcm::OrientationType orient = o->GetOrientationType( f );
     
             std::cout << "TypeOrientation = " << orient << " (-> " 
-                     << o.GetOrientationTypeString(orient) << " )" << std::endl;
+                     << o->GetOrientationTypeString(orient) << " )" << std::endl;
          }
 
-         std::string ori = o.GetOrientation ( f );
+         std::string ori = o->GetOrientation ( f );
          if (ori != "\\" )
             std::cout << "Orientation [" << ori << "]" << std::endl;
+   
+         o->gdcm::Orientation::Delete(); 
 
 //------------------------------- 
-
         
          if (f->IsReadable())
             std::cout <<std::endl<<it->c_str()<<" is Readable"<<std::endl;
index d083bf07b087277587fab69aada44f211c87d26d..c1580202ae299c3af73dcc92c5874a97043cea8e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestPrintAllDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 14:52:31 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2005/11/18 11:44:33 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -101,10 +101,12 @@ int TestPrintAllDocument(int, char *[])
                                           f->GetEntryString(0x0020,0x0037);
       if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
       {
-         gdcm::Orientation o;
-         gdcm::OrientationType orient = o.GetOrientationType( f );
+         gdcm::Orientation *o = gdcm::Orientation::New();
+         gdcm::OrientationType orient = o->GetOrientationType( f );
          std::cout << " ---------------------- Orientation " << orient
                    << std::endl;
+         o->gdcm::Orientation::Delete(); 
       }
 
       if( f->IsReadable() )
index cfb9a7c3257e3dab13348869ee806bfaec70c7ef..4da69db53f718787e65e02417626998a89e7d833 100644 (file)
@@ -4,8 +4,8 @@
   Module:    $RCSfile: gdcmFileHelper.cxx,v $
   Language:  C++
 
-  Date:      $Date: 2005/11/07 14:10:39 $
-  Version:   $Revision: 1.81 $
+  Date:      $Date: 2005/11/18 11:42:48 $
+  Version:   $Revision: 1.82 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1526,8 +1526,9 @@ void FileHelper::CheckMandatoryElements()
    
    // Patient Orientation
    // Can be computed from (0020|0037) :  Image Orientation (Patient)
-   gdcm::Orientation o;
-   std::string ori = o.GetOrientation ( FileInternal );
+   gdcm::Orientation *o = gdcm::Orientation::New();
+   std::string ori = o->GetOrientation ( FileInternal );
+   o->Delete();
    if (ori != "\\" )
       CheckMandatoryEntry(0x0020,0x0020,ori);
    else   
index 360538ecba1a4524ba26816e0e3ab1bdd81506b4..870bee43620edba224da86db640cc2827c84e114 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmOrientation.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/23 15:12:24 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2005/11/18 11:42:48 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -19,7 +19,7 @@
 #ifndef GDCMORIENTATION_H
 #define GDCMORIENTATION_H
 
-#include "gdcmBase.h"
+#include "gdcmRefCounter.h"
 #include <map>
 
 namespace gdcm 
@@ -92,19 +92,22 @@ typedef enum {
    HeartSagitalInvert = -6
 } OrientationType;
 
-class GDCM_EXPORT Orientation : public Base
+class GDCM_EXPORT Orientation : public RefCounter
 {
+   gdcmTypeMacro(Orientation);
 public:
-/// \brief Constructor
-  Orientation() {}
-/// \brief Canonical Destructor
-  ~Orientation() {}
+   static Orientation *New() {return new Orientation();}
 
   OrientationType GetOrientationType( File *file );
   std::string GetOrientation ( File *file );  
   
   static const char* GetOrientationTypeString(OrientationType const o);
-
+  
+protected:
+/// \brief Constructor
+  Orientation() {}
+/// \brief Canonical Destructor
+  ~Orientation() {}
 private:
    Res VerfCriterion(int typeCriterion, double criterionNew, Res const &res);
    double CalculLikelyhood2Vec(vector3D const &refA, vector3D const &refB,