2004-01-23 Benoit Regrain
* Bug fix on field having a VR = 'UI'. Assume that is a string field
* Bug fix on test suite after remove the strip made on not string fields
+ * Split the IsReadable method between gdcmParser which test that the file
+ is dicom and gdcmHeader which test that it's an image file
2004-01-22 Benoit Regrain
* DicomDir : clean code, add methods, set variables in protected or private
//-----------------------------------------------------------------------------
// Public
+/**
+ * \ingroup gdcmHeader
+ * \brief This predicate, based on hopefully reasonable heuristics,
+ * decides whether or not the current gdcmParser was properly parsed
+ * and contains the mandatory information for being considered as
+ * a well formed and usable Dicom/Acr File.
+ * @return true when gdcmParser is the one of a reasonable Dicom/Acr file,
+ * false otherwise.
+ */
+bool gdcmHeader::IsReadable(void)
+{
+ if(!gdcmParser::IsReadable())
+ return(false);
+
+ std::string res = GetEntryByNumber(0x0028, 0x0005);
+ if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
+ return false; // Image Dimensions
+
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
+ return false; // "Bits Allocated"
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
+ return false; // "Bits Stored"
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
+ return false; // "High Bit"
+ if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
+ return false; // "Pixel Representation"
+ return true;
+}
+
/**
* \ingroup gdcmHeader
* \brief Determines if the Transfer Syntax was already encountered
virtual ~gdcmHeader();
// Standard values and informations contained in the header
+ virtual bool IsReadable(void);
bool IsJPEGBaseLineProcess1TransferSyntax(void);
bool IsJPEGExtendedProcess2_4TransferSyntax(void);
bool IsJPEGExtendedProcess3_5TransferSyntax(void);
//-----------------------------------------------------------------------------
// Print
-
void gdcmHeaderEntry::Print(std::ostream & os) {
size_t o;
unsigned short int g, e;
s << "[" << GetName()<< "]";
s << " [" << d2 << "]";
- // Display the UID value (instead of displaying the rough code)
+
+ // Display the UID value (instead of displaying the rough code)
if (g == 0x0002) { // Any more to be displayed ?
- if ( (e == 0x0010) || (e == 0x0002) )
- s << " ==>\t[" << ts->GetValue(v) << "]";
+ if ( (e == 0x0010) || (e == 0x0002) )
+ s << " ==>\t[" << ts->GetValue(v) << "]";
} else {
if (g == 0x0008) {
- if ( (e == 0x0016) || (e == 0x1150) )
- s << " ==>\t[" << ts->GetValue(v) << "]";
+ if ( (e == 0x0016) || (e == 0x1150) )
+ s << " ==>\t[" << ts->GetValue(v) << "]";
}
- }
+ }
if (e == 0x0000) { // elem 0x0000 --> group length
if (v == "4294967295") // to avoid troubles in convertion
sprintf (st," x(ffffffff)");
*/
bool gdcmParser::IsReadable(void)
{
- std::string res = GetEntryByNumber(0x0028, 0x0005);
- if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
- return false; // Image Dimensions
-
- if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
- return false; // "Bits Allocated"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
- return false; // "Bits Stored"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
- return false; // "High Bit"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
- return false; // "Pixel Representation"
- return true;
+ if(filetype==Unknown)
+ return(false);
+
+ if(listEntries.size()<=0)
+ return(false);
+
+ return(true);
}
/**
bool SetShaDict(DictKey dictName);
// Informations contained in the parser
- bool IsReadable(void);
+ virtual bool IsReadable(void);
bool IsImplicitVRLittleEndianTransferSyntax(void);
bool IsExplicitVRLittleEndianTransferSyntax(void);
bool IsDeflatedExplicitVRLittleEndianTransferSyntax(void);
from.getline(buff, 1024, ' ');
key = buff;
- if(key.size()%2==1)
- {
- key.resize(key.size()+1);
- key[key.size()-1]=0;
- }
-
eatwhite(from);
from.getline(buff, 1024, '\n');
name = buff;