Program: gdcm
Module: $RCSfile: PrintFile.cxx,v $
Language: C++
- Date: $Date: 2005/09/30 17:42:17 $
- Version: $Revision: 1.60 $
+ Date: $Date: 2005/10/01 19:39:14 $
+ Version: $Revision: 1.61 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// ----------- End Arguments Manager ---------
- std::string tabOrientation[13] = {
- "Not Applicable",
- "Axial",
- "Coronal",
- "Sagital",
- "Heart Axial",
- "Heart Coronal",
- "Heart Sagital",
- "Axial invert",
- "Coronal invert",
- "Sagital invert",
- "Heart Axial invert",
- "Heart Coronal invert",
- "Heart Sagital invert"
- };
if (ddict)
{
strImageOrientationRET != gdcm::GDCM_UNFOUND )
{
- double orient = o.TypeOrientation( f );
- int k = (int)orient;
- if (k < 0)
- k = -k + 6;
+ gdcm::OrientationType orient = o.GetOrientationType( f );
std::cout << "TypeOrientation = " << orient << " (-> "
- << tabOrientation[k] << " )" << std::endl;
+ << o.GetOrientationTypeString(orient) << " )" << std::endl;
}
std::string ori = o.GetOrientation ( f );
if (ori != gdcm::GDCM_UNFOUND )
std::cout << "- Orientation [" << ori << "]" << std::endl;
- double d = o.TypeOrientation( f );
- int k = (int)d;
- if (k < 0)
- k = -k + 6;
+ gdcm::OrientationType d = o.GetOrientationType( f );
std::cout << "TypeOrientation = " << d << " (-> "
- << tabOrientation[k] << std::endl;
+ << o.GetOrientationTypeString(d) << std::endl;
if (f->IsReadable())
std::cout <<std::endl<<it->c_str()<<" is Readable"<<std::endl;
Program: gdcm
Module: $RCSfile: TestPrintAllDocument.cxx,v $
Language: C++
- Date: $Date: 2005/09/16 17:19:24 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/10/01 19:39:15 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if ( strImageOrientationPatient != gdcm::GDCM_UNFOUND )
{
gdcm::Orientation o;
- double orient = o.TypeOrientation( f );
+ gdcm::OrientationType orient = o.GetOrientationType( f );
std::cout << " ---------------------- Orientation " << orient
<< std::endl;
}
Program: gdcm
Module: $RCSfile: gdcmOrientation.cxx,v $
Language: C++
- Date: $Date: 2005/09/30 17:45:01 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/10/01 19:39:16 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* # 6 : Heart Sagital
* # -6 : Heart Sagital invert
*/
-double Orientation::TypeOrientation( File *f )
+
+static const char *OrientationTypeStrings[] = {
+ "Not Applicable",
+ "Axial",
+ "Coronal",
+ "Sagital",
+ "Heart Axial",
+ "Heart Coronal",
+ "Heart Sagital",
+ "Axial invert",
+ "Coronal invert",
+ "Sagital invert",
+ "Heart Axial invert",
+ "Heart Coronal invert",
+ "Heart Sagital invert",
+ NULL
+};
+
+const char* Orientation::GetOrientationTypeString(OrientationType const o)
+{
+ int k = (int)o;
+ if (k < 0)
+ k = -k + 6;
+
+ return OrientationTypeStrings[k];
+}
+
+OrientationType Orientation::GetOrientationType( File *f )
{
float iop[6];
bool succ = f->GetImageOrientationPatient( iop );
if ( !succ )
{
- gdcmErrorMacro( "No Image Orientation (0020,0037) found in the file, cannot proceed." )
- return 0;
+ gdcmErrorMacro( "No Image Orientation (0020,0037)/(0020,0032) found in the file, cannot proceed." )
+ return NotApplicable;
}
-/*
-std::cout << " iop : ";
-for(int i=0;i<6;i++)
- std::cout << iop[i] << " ";
-std::cout << std::endl;
-*/
vector3D ori1;
vector3D ori2;
res=VerfCriterion( i, CalculLikelyhood2Vec(refA,refB,ori1,ori2), res );
res=VerfCriterion( -i, CalculLikelyhood2Vec(refB,refA,ori1,ori2), res );
}
- return res.first;
-/*
-// i=0
-// res=[0,99999] ## [ <result> , <memory of the last succes calculus> ]
-// for plane in dicPlane:
-// i=i+1
-// refA=plane[0]
-// refB=plane[1]
-// res=self.VerfCriterion( i , self.CalculLikelyhood2Vec(refA,refB,ori1,ori2) , res )
-// res=self.VerfCriterion( -i , self.CalculLikelyhood2Vec(refB,refA,ori1,ori2) , res )
-// return res[0]
-*/
+ gdcmAssertMacro( res.first <= 6 && res.first >= -6);
+ return (OrientationType)res.first;
}
Res
res.first = type;
res.second = criterion;
return res;
-/*
-// type = res[0]
-// criterion = res[1]
-// # if criterionNew<0.1 and criterionNew<criterion:
-// if criterionNew<criterion:
-// criterion=criterionNew
-// type=typeCriterion
-// return [ type , criterion ]
-*/
-
}
inline double square_dist(vector3D const &v1, vector3D const &v2)
Program: gdcm
Module: $RCSfile: gdcmOrientation.h,v $
Language: C++
- Date: $Date: 2005/10/01 15:51:42 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/10/01 19:39:16 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* You'll probabely have 3 letters for X axis and Y axis, and the image remains *perfectly* sagital !
* The values are given within the 'imager referential', better than within the 'Patient Referential' ...
*/
+typedef enum {
+ NotApplicable = 0,
+ Axial = 1,
+ AxialInvert = -1,
+ Coronal = 2,
+ CoronalInvert = -2,
+ Sagital = 3,
+ SagitalInvert = -3,
+ HeartAxial = 4,
+ HeartAxialInvert = -4,
+ HeartCoronal = 5,
+ HeartCoronalInvert = -5,
+ HeartSagital = 6,
+ HeartSagitalInvert = -6
+} OrientationType;
+
class GDCM_EXPORT Orientation : public Base
{
public:
Orientation() {}
~Orientation() {}
- double TypeOrientation( File *file );
+ OrientationType GetOrientationType( File *file );
std::string GetOrientation ( File *file );
+ static const char* GetOrientationTypeString(OrientationType const o);
+
private:
Res VerfCriterion(int typeCriterion, double criterionNew, Res const &res);
double CalculLikelyhood2Vec(vector3D const &refA, vector3D const &refB,