From: jpr Date: Wed, 29 Mar 2006 16:13:00 +0000 (+0000) Subject: Oops. X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=195ebc4ca17c18f169cb9ad26162a09b52ab1856;p=gdcm.git Oops. Forget to commit theese ones. --- diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 851fd4a2..6d45581b 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2006/03/01 10:15:12 $ - Version: $Revision: 1.316 $ + Date: $Date: 2006/03/29 16:13:00 $ + Version: $Revision: 1.317 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -118,6 +118,7 @@ File::File(): GrPixel = 0x7fe0; // to avoid further troubles NumPixel = 0x0010; BasicOffsetTableItemValue = 0; + FourthDimensionLocation = TagKey(0,0); } @@ -246,6 +247,7 @@ bool File::DoTheLoadingJob( ) } return true; } + /** * \brief This predicate, based on hopefully reasonable heuristics, * decides whether or not the current File was properly parsed @@ -450,6 +452,34 @@ int File::GetZSize() return 1; } +/** + * \brief Retrieve the -unnormalized- number of 'times' of '4D image'. + * User has to tell gdcm the location of this '4th Dimension component' + * using SetFourthDimensionLocation() method before. + * \warning The defaulted value is 1. + * @return The encountered size when found, 1 by default + * (The file doesn't contain a '4D image'.). + */ +int File::GetTSize() +{ + if (FourthDimensionLocation == TagKey(0,0) )// 4D location is not set : not a 4D object + return 1; + + DataEntry *entry = GetDataEntry(FourthDimensionLocation.GetGroup(), + FourthDimensionLocation.GetElement() ); + if( !entry ) + { + gdcmWarningMacro( " FourthDimensionLocation not found at : " << + std::hex << FourthDimensionLocation.GetGroup() + << "|" << FourthDimensionLocation.GetElement()); + return 1; + } + else + { + return (int)entry->GetValue(0); + } +} + /** * \brief gets the info from 0018,1164 : ImagerPixelSpacing * then 0028,0030 : Pixel Spacing @@ -511,7 +541,6 @@ float File::GetXSpacing() { gdcmWarningMacro( "Unfound Pixel Spacing (0028,0030)" ); } - return xspacing; } diff --git a/src/gdcmFile.h b/src/gdcmFile.h index 6e191429..eaf2d269 100644 --- a/src/gdcmFile.h +++ b/src/gdcmFile.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.h,v $ Language: C++ - Date: $Date: 2006/02/16 20:06:14 $ - Version: $Revision: 1.124 $ + Date: $Date: 2006/03/29 16:13:00 $ + Version: $Revision: 1.125 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,7 +21,7 @@ #include "gdcmDebug.h" #include "gdcmDocument.h" - +#include "gdcmTagKey.h" namespace gdcm @@ -108,6 +108,9 @@ public: bool Load(); // Standard values and informations contained in the header bool IsReadable(); + + void SetFourthDimensionLocation(uint16_t group, uint16_t elem) { + FourthDimensionLocation = TagKey(group, elem); } // Some heuristic based accessors, end user intended int GetImageNumber(); @@ -116,7 +119,8 @@ public: int GetXSize(); int GetYSize(); int GetZSize(); - + int GetTSize(); // unnormalized in DICOM V3 + float GetXSpacing(); float GetYSpacing(); float GetZSpacing(); @@ -196,6 +200,9 @@ protected: /// In order to make things easier the parser shall store the proper value /// in GrPixel to provide a unique access facility. uint16_t GrPixel; + /// \brief allows user to tell gdcm in which DataElement is stored + ///the -unnormalized- 4th Dimension + TagKey FourthDimensionLocation; private: bool DoTheLoadingJob();