Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2005/11/09 10:18:44 $
- Version: $Revision: 1.303 $
+ Date: $Date: 2005/11/28 11:54:51 $
+ Version: $Revision: 1.310 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
bool File::DoTheLoadingJob( )
{
-
// for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
// We may encounter the 'RETired' (0x0028, 0x0200) tag
// (Image Location") . This entry contains the number of
* \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;
// if no 'Spacing Between Slices' is found,
// we assume slices join together
// (no overlapping, no interslice gap)
- // if they don't, we're fucked up
entry = GetDataEntry(0x0018,0x0050);
if( entry )
{
else
gdcmWarningMacro("Unfound Slice Thickness (0018,0050)");
+ // if no 'Spacing Between Slices' is found,
+ // we assume slices join together
+ // (no overlapping, no interslice gap)
+ entry = GetDataEntry(0x3004,0x000c);
+ if( entry )
+ {
+ float z1 = (float)entry->GetValue(0);
+ float z2 = (float)entry->GetValue(1);
+ zspacing = z2 - z1; // can be negative...
+
+ if ( zspacing == 0.0 )
+ zspacing = 1.0;
+ return zspacing;
+ }
+
return zspacing;
}
{
std::string strImOriPat;
//iop is supposed to be float[6]
- iop[0] = iop[1] = iop[2] = iop[3] = iop[4] = iop[5] = 0.;
+ 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 )
{
// in order not to pollute output we don't warn on 'delimitors'
if (itemTagGroup != 0xfffe || testGroup != 0xfffe )
- gdcmErrorMacro( "Wrong Item Tag found:"
+ gdcmWarningMacro( "Wrong Item Tag found:"
<< " We should have found tag ("
<< DictEntry::TranslateToKey(testGroup,testElem) << ")" << std::endl
<< " but instead we encountered tag ("
// These are the deprecated method that one day should be removed (after the next release)
-#ifndef GDCM_LEGACY_REMOVE
+//#ifndef GDCM_LEGACY_REMOVE
/*
* \ brief Loader. (DEPRECATED : temporaryly kept not to break the API)
* @ param fileName file to be open for parsing
* or no tag was found.
* @ deprecated Use the Load() [ + SetLoadMode() ] + SetFileName() functions instead
*/
+ /*
bool File::Load( std::string const &fileName )
{
GDCM_LEGACY_REPLACED_BODY(File::Load(std::string), "1.2",
return DoTheLoadingJob( );
}
-#endif
+*/
+//#endif
//-----------------------------------------------------------------------------
// Print