X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmFile.cxx;h=1c5bebc48f7a4571e12a4ecb82b8e37e0aa575d5;hb=98f703e9f1e8335c483a3ac7c161d6a984e3e242;hp=e752e2a796d0916d5dee1c27fdf3196f32e284b5;hpb=f8be63ebb26fa8fc3381c4ac129138fabf229412;p=gdcm.git diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index e752e2a7..1c5bebc4 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2005/11/25 03:26:41 $ - Version: $Revision: 1.307 $ + Date: $Date: 2005/12/21 14:52:12 $ + Version: $Revision: 1.313 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -561,18 +561,18 @@ float File::GetYSpacing() * \brief gets the info from 0018,0088 : Space Between Slices * else from 0018,0050 : Slice Thickness * else 1.0 + * + * When an element is missing, we suppose slices join together + * (no overlapping, no interslice gap) but we have no way to check it ! + * For *Dicom* images, ZSpacing *should be* calculated using + * XOrigin, YOrigin, ZOrigin (of the top left image corner) + * of 2 consecutive images, and the Orientation + * Computing ZSpacing on a single image is not really meaningfull ! + * @return Z dimension of a voxel-to be */ float File::GetZSpacing() { - // ---> - // ---> Warning : - // ---> - // For *Dicom* images, ZSpacing should be calculated using - // XOrigin, YOrigin, ZOrigin (of the top left image corner) - // of 2 consecutive images, and the Orientation - // - // Computing ZSpacing on a single image is not really meaningfull ! float zspacing = 1.0f; @@ -768,17 +768,19 @@ float File::GetZOrigin() /** * \brief gets the info from 0020,0037 : Image Orientation Patient * or from 0020 0035 : Image Orientation (RET) + * * (needed to organize DICOM files based on their x,y,z position) - * @param iop adress of the (6)float array to receive values - * @return true when one of the tag is found - * false when nothing is found + * + * @param iop adress of the (6)float array to receive values. + * (defaulted as 1.,0.,0.,0.,1.,0. if nothing -or inconsistent stuff- + * is found. + * @return true when one of the tag -with consistent values- is found + * false when nothing or inconsistent stuff - is found */ bool File::GetImageOrientationPatient( float iop[6] ) { std::string strImOriPat; //iop is supposed to be float[6] - iop[0] = iop[4] = 1.; - iop[1] = iop[2] = iop[3] = iop[5] = 0.; // 0020 0037 DS REL Image Orientation (Patient) if ( (strImOriPat = GetEntryString(0x0020,0x0037)) != GDCM_UNFOUND ) @@ -786,10 +788,14 @@ bool File::GetImageOrientationPatient( float iop[6] ) if ( sscanf( strImOriPat.c_str(), "%f \\ %f \\%f \\%f \\%f \\%f ", &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 ) { + iop[0] = iop[4] = 1.; + iop[1] = iop[2] = iop[3] = iop[5] = 0.; gdcmWarningMacro( "Wrong Image Orientation Patient (0020,0037)." << " Less than 6 values were found." ); return false; } + else + return true; } //For ACR-NEMA // 0020 0035 DS REL Image Orientation (RET) @@ -798,12 +804,16 @@ bool File::GetImageOrientationPatient( float iop[6] ) if ( sscanf( strImOriPat.c_str(), "%f \\ %f \\%f \\%f \\%f \\%f ", &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 ) { + iop[0] = iop[4] = 1.; + iop[1] = iop[2] = iop[3] = iop[5] = 0.; gdcmWarningMacro( "wrong Image Orientation Patient (0020,0035). " << "Less than 6 values were found." ); return false; } + else + return true; } - return true; + return false; } /** @@ -1153,7 +1163,7 @@ int File::GetLUTNbits() /** *\brief gets the info from 0028,1052 : Rescale Intercept - * @return Rescale Intercept + * @return Rescale Intercept. defaulted to 0.0 is not found or empty */ float File::GetRescaleIntercept() { @@ -1170,7 +1180,7 @@ float File::GetRescaleIntercept() /** *\brief gets the info from 0028,1053 : Rescale Slope - * @return Rescale Slope + * @return Rescale Slope. defaulted to 0.0 is not found or empty */ float File::GetRescaleSlope() { @@ -1496,7 +1506,7 @@ bool File::Write(std::string fileName, FileType writetype) e0000->SetString(sLen.str()); } - // FIXME : Derma?.dcm does not have it...let's remove it ?!? JPRx + /// \todo FIXME : Derma?.dcm does not have it...let's remove it ?!? JPRx if( writetype != JPEG ) { int i_lgPix = GetEntryLength(GrPixel, NumPixel); @@ -1516,6 +1526,7 @@ bool File::Write(std::string fileName, FileType writetype) return true; } + //----------------------------------------------------------------------------- // Protected