]> Creatis software - gdcm.git/commitdiff
Oops.
authorjpr <jpr>
Wed, 29 Mar 2006 16:13:00 +0000 (16:13 +0000)
committerjpr <jpr>
Wed, 29 Mar 2006 16:13:00 +0000 (16:13 +0000)
Forget to commit theese ones.

src/gdcmFile.cxx
src/gdcmFile.h

index 851fd4a25dfba476b854b3c3cb8429fa50b315fc..6d45581b8e9c420d9acb1f1ec63752835e723e80 100644 (file)
@@ -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;
 }
 
index 6e191429bb9b35f664f9751a4594abd0f43c6d8b..eaf2d2691e4e039b5a9ef55c83c75092f42474b0 100644 (file)
@@ -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();