From: jpr Date: Fri, 18 Nov 2005 11:42:48 +0000 (+0000) Subject: gdcm::Orientation uses RefCounter X-Git-Tag: Version1.3~70 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4fbe563dc18455266f880586fa2aca2cfb1012bc;p=gdcm.git gdcm::Orientation uses RefCounter --- diff --git a/Example/PrintFile.cxx b/Example/PrintFile.cxx index 71a2ea9c..3cd654f9 100644 --- a/Example/PrintFile.cxx +++ b/Example/PrintFile.cxx @@ -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 <c_str()<<" is Readable"<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() ) diff --git a/src/gdcmFileHelper.cxx b/src/gdcmFileHelper.cxx index cfb9a7c3..4da69db5 100644 --- a/src/gdcmFileHelper.cxx +++ b/src/gdcmFileHelper.cxx @@ -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 diff --git a/src/gdcmOrientation.h b/src/gdcmOrientation.h index 360538ec..870bee43 100644 --- a/src/gdcmOrientation.h +++ b/src/gdcmOrientation.h @@ -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 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,