+ gdcmElValue* NewElVal = (gdcmElValue*)0;
+ string NewVal;
+
+ NewElVal = NewManualElValToPubDict("gdcmXSize", "US");
+ if (!NewElVal) return;
+ NewVal = GetElValByName("Rows");
+ if (NewVal != "gdcm::Unfound")
+ NewElVal->SetValue(NewVal);
+ else
+ NewElVal->SetValue("0");
+
+ NewElVal = NewManualElValToPubDict("gdcmYSize", "US");
+ if (!NewElVal) return;
+ NewVal = GetElValByName("Columns");
+ if (NewVal != "gdcm::Unfound")
+ NewElVal->SetValue(NewVal);
+ else
+ NewElVal->SetValue("0");
+
+
+ NewElVal = NewManualElValToPubDict("gdcmZSize", "US");
+ if (!NewElVal) return;
+ NewVal = GetElValByNumber(0x0028,0x0008); // 0028 0008 IS IMG Number of Frames (DICOM)
+ if (NewVal == "gdcm::Unfound") {
+ NewVal = GetElValByNumber(0x0028,0x0012); // 028 0012 US IMG Planes (ACR-NEMA)
+ if (NewVal == "gdcm::Unfound") { // Warning !!! : 6000 0012 US OLY Planes
+ NewElVal->SetValue("0");
+ } else {
+ NewElVal->SetValue(NewVal);
+ }
+ } else {
+ NewElVal->SetValue(NewVal);
+ } // length is still wrong
+} // do we care about it?
+
+
+/**
+ * \ingroup gdcmHeader
+ * \brief This predicate, based on hopefully reasonnable heuristics,
+ * decides whether or not the current gdcmHeader was properly parsed
+ * and contains the mandatory information for being considered as
+ * a well formed and usable image.
+ * @return true when gdcmHeader is the one of a reasonable Dicom file,
+ * false otherwise.
+ */
+bool gdcmHeader::IsReadable(void) {
+ if ( GetElValByName("Image Dimensions") != "gdcm::Unfound"
+ && atoi(GetElValByName("Image Dimensions").c_str()) > 4 ) {
+ return false;
+ }
+ if ( GetElValByName("Bits Allocated") == "gdcm::Unfound" )
+ return false;
+ if ( GetElValByName("Bits Stored") == "gdcm::Unfound" )
+ return false;
+ if ( GetElValByName("High Bit") == "gdcm::Unfound" )
+ return false;
+ if ( GetElValByName("Pixel Representation") == "gdcm::Unfound" )
+ return false;
+ return true;
+}