Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:59 $
- Version: $Revision: 1.227 $
+ Date: $Date: 2005/01/14 15:06:37 $
+ Version: $Revision: 1.232 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDebug.h"
#include "gdcmTS.h"
#include "gdcmValEntry.h"
+#include "gdcmBinEntry.h"
#include <stdio.h> //sscanf
#include <vector>
// is found by indirection through the "Image Location").
// Inside the group pointed by "Image Location" the searched element
// is conventionally the element 0x0010 (when the norm is respected).
- // When the "Image Location" is absent we default to group 0x7fe0.
+ // When the "Image Location" is Missing we default to group 0x7fe0.
// Note: this IS the right place for the code
// Image Location
RemoveEntryNoDestroy(e);
}
}
+
+/*
+#ifdef GDCM_WORDS_BIGENDIAN
+ // Super Super hack that will make gdcm a BOMB ! but should
+ // Fix temporarily the dashboard
+ BinEntry *b = GetBinEntry(GrPixel,NumPixel);
+ if ( GetPixelSize() == 16 )
+ {
+ uint16_t *im16 = (uint16_t*)b->GetBinArea();
+ int lgr = b->GetLength();
+ for( int i = 0; i < lgr / 2; i++ )
+ {
+ im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+ }
+ }
+#endif //GDCM_WORDS_BIGENDIAN
+*/
+
Document::WriteContent(fp,filetype);
+/*
+#ifdef GDCM_WORDS_BIGENDIAN
+ // Flip back the pixel ... I told you this is a hack
+ if ( GetPixelSize() == 16 )
+ {
+ uint16_t *im16 = (uint16_t*)b->GetBinArea();
+ int lgr = b->GetLength();
+ for( int i = 0; i < lgr / 2; i++ )
+ {
+ im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+ }
+ }
+#endif //GDCM_WORDS_BIGENDIAN
+*/
+
fp->close();
delete fp;
* \brief Retrieve the number of planes of volume or the number
* of frames of a multiframe.
* \warning When present we consider the "Number of Frames" as the third
- * dimension. When absent we consider the third dimension as
+ * dimension. When Missing we consider the third dimension as
* being the ACR-NEMA "Planes" tag content.
* @return The encountered size when found, 1 by default (single image).
*/
// disjointes (Spacing between Slices > Slice Thickness)
// Slice Thickness : epaisseur de tissus sur laquelle est acquis le signal
// ca interesse le physicien de l'IRM, pas le visualisateur de volumes ...
- // Si le Spacing Between Slices est absent,
+ // Si le Spacing Between Slices est Missing,
// on suppose que les coupes sont jointives
const std::string &strSpacingBSlices = GetEntry(0x0018,0x0088);
if ( strSpacingBSlices == GDCM_UNFOUND )
{
- gdcmVerboseMacro("Unfound StrSpacingBSlices");
+ gdcmVerboseMacro("Unfound Spacing Between Slices (0018,0088)");
const std::string &strSliceThickness = GetEntry(0x0018,0x0050);
if ( strSliceThickness == GDCM_UNFOUND )
{
+ gdcmVerboseMacro("Unfound Slice Thickness (0018,0050)");
return 1.;
}
else
if( sscanf( strRescInter.c_str(), "%f", &resInter) != 1 )
{
// bug in the element 0x0028,0x1052
- gdcmVerboseMacro( "Rescale Intercept is empty." );
+ gdcmVerboseMacro( "Rescale Intercept (0028,1052) is empty." );
}
}
if( sscanf( strRescSlope.c_str(), "%f", &resSlope) != 1)
{
// bug in the element 0x0028,0x1053
- gdcmVerboseMacro( "Rescale Slope is empty.");
+ gdcmVerboseMacro( "Rescale Slope (0028,1053) is empty.");
}
}
std::string strSize = GetEntry( 0x0028, 0x0101 );
if ( strSize == GDCM_UNFOUND )
{
- gdcmVerboseMacro("This is supposed to be mandatory");
+ gdcmVerboseMacro("(0028,0101) is supposed to be mandatory");
return 0; // It's supposed to be mandatory
// the caller will have to check
}
/**
* \brief Retrieve the high bit position.
- * \warning The method defaults to 0 when information is absent.
+ * \warning The method defaults to 0 when information is Missing.
* The responsability of checking this value is left to the caller.
- * @return The high bit positin when present. 0 when absent.
+ * @return The high bit positin when present. 0 when Missing.
*/
int Header::GetHighBitPosition()
{
std::string strSize = GetEntry( 0x0028, 0x0102 );
if ( strSize == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "This is supposed to be mandatory");
+ gdcmVerboseMacro( "(0028,0102) is supposed to be mandatory");
return 0;
}
return atoi( strSize.c_str() );
/**
* \brief Check wether the pixels are signed or UNsigned data.
- * \warning The method defaults to false (UNsigned) when information is absent.
+ * \warning The method defaults to false (UNsigned) when information is Missing.
* The responsability of checking this value is left to the caller.
* @return True when signed, false when UNsigned
*/
std::string strSize = GetEntry( 0x0028, 0x0103 );
if ( strSize == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "This is supposed to be mandatory");
+ gdcmVerboseMacro( "(0028,0103) is supposed to be mandatory");
return false;
}
int sign = atoi( strSize.c_str() );
std::string strSize = GetEntry(0x0028,0x0100);
if ( strSize == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "This is supposed to be mandatory");
+ gdcmVerboseMacro( "(0028,0100) is supposed to be mandatory");
return 0; // It's supposed to be mandatory
// the caller will have to check
}
const std::string& strSize = GetEntry(0x0028,0x0002);
if ( strSize == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "This is supposed to be mandatory");
+ gdcmVerboseMacro( "(0028,0002) is supposed to be mandatory");
return 1; // Well, it's supposed to be mandatory ...
// but sometimes it's missing : *we* assume Gray pixels
}
}
if ( PhotometricInterp == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "Absent Photometric Interpretation");
+ gdcmVerboseMacro( "Not found : Photometric Interpretation (0028,0004)");
}
return false;
}
}
if ( PhotometricInterp == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "Absent Palette color");
+ gdcmVerboseMacro( "Not found : Palette color (0028,0004)");
}
return false;
}
}
if ( PhotometricInterp == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "Absent YBR Full");
+ gdcmVerboseMacro( "Not found : YBR Full (0028,0004)");
}
return false;
}
std::string strSize = GetEntry(0x0028,0x0006);
if ( strSize == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "Absent Planar Configuration");
+ gdcmVerboseMacro( "Not found : Planar Configuration (0028,0006)");
return 0;
}
return atoi( strSize.c_str() );
std::string bitsAlloc = GetEntry(0x0028, 0x0100); // Bits Allocated
if ( bitsAlloc == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "Unfound Bits Allocated");
+ gdcmVerboseMacro( "Missing Bits Allocated (0028,0100)");
bitsAlloc = "16";
}
if (sign == GDCM_UNFOUND )
{
- gdcmVerboseMacro( "Unfound Pixel Representation");
+ gdcmVerboseMacro( "Missing Pixel Representation (0028,0103)");
bitsAlloc = "0";
}
else if ( sign == "0" )
return lutNbits;
}
-/**
- * \brief Accesses the info from 0002,0010 : Transfert Syntax and TS
- * else 1.
- * @return The full Transfert Syntax Name (as opposed to Transfert Syntax UID)
- */
-std::string Header::GetTransfertSyntaxName()
-{
- // use the TS (TS : Transfert Syntax)
- std::string transfertSyntax = GetEntry(0x0002,0x0010);
-
- if ( transfertSyntax == GDCM_NOTLOADED )
- {
- gdcmVerboseMacro( "Transfert Syntax not loaded. " << std::endl
- << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" );
- return "Uncompressed ACR-NEMA";
- }
- if ( transfertSyntax == GDCM_UNFOUND )
- {
- gdcmVerboseMacro( "Unfound Transfert Syntax (0002,0010)");
- return "Uncompressed ACR-NEMA";
- }
-
- while ( ! isdigit((unsigned char)transfertSyntax[transfertSyntax.length()-1]) )
- {
- transfertSyntax.erase(transfertSyntax.length()-1, 1);
- }
- // we do it only when we need it
- TS* ts = Global::GetTS();
- std::string tsName = ts->GetValue( transfertSyntax );
-
- //delete ts; /// \todo Seg Fault when deleted ?!
- return tsName;
-}
//-----------------------------------------------------------------------------
// Protected