+ // Potentialy this is a post-processed image
+ // 'Media Storage SOP Class UID' --> [Secondary Capture Image Storage]
+ CopyMandatoryEntry(0x0008,0x0016,"1.2.840.10008.5.1.4.1.1.7");
+
+ // FIXME : Must we Force Value, or Default value ?
+ // Is it Type 1 for any Modality ?
+ // --> Answer seems to be NO :-(
+ // FIXME : we should write it only when we are *sure* the image
+ // *does not* come from an imager (see also 0018,0x1164)
+
+ // Conversion Type.
+ // Other possible values are :
+ // See PS 3.3, Page 408
+
+ // DV = Digitized Video
+ // DI = Digital Interface
+ // DF = Digitized Film
+ // WSD = Workstation
+ // SD = Scanned Document
+ // SI = Scanned Image
+ // DRW = Drawing
+ // SYN = Synthetic Image
+
+ CheckMandatoryEntry(0x0008,0x0064,"SYN");
+ }
+
+ // ---- The user will never have to take any action on the following ----
+
+ // new value for 'SOP Instance UID'
+ //SetMandatoryEntry(0x0008,0x0018,Util::CreateUniqueUID());
+
+ // Instance Creation Date
+ const std::string &date = Util::GetCurrentDate();
+ CopyMandatoryEntry(0x0008,0x0012,date);
+
+ // Instance Creation Time
+ const std::string &time = Util::GetCurrentTime();
+ CopyMandatoryEntry(0x0008,0x0013,time);
+
+ // Study Date
+ CopyMandatoryEntry(0x0008,0x0020,date);
+ // Study Time
+ CopyMandatoryEntry(0x0008,0x0030,time);
+
+ // Accession Number
+ //CopyMandatoryEntry(0x0008,0x0050,"");
+ CheckMandatoryEntry(0x0008,0x0050,"");
+
+
+ // ----- Add Mandatory Entries if missing ---
+ // Entries whose type is 1 are mandatory, with a mandatory value
+ // Entries whose type is 1c are mandatory-inside-a-Sequence,
+ // with a mandatory value
+ // Entries whose type is 2 are mandatory, with an optional value
+ // Entries whose type is 2c are mandatory-inside-a-Sequence,
+ // with an optional value
+ // Entries whose type is 3 are optional
+
+ // 'Study Instance UID'
+ // Keep the value if exists
+ // The user is allowed to create his own Study,
+ // keeping the same 'Study Instance UID' for various images
+ // The user may add images to a 'Manufacturer Study',
+ // adding new Series to an already existing Study
+ CheckMandatoryEntry(0x0020,0x000d,Util::CreateUniqueUID());
+
+ // 'Serie Instance UID'
+ // Keep the value if exists
+ // The user is allowed to create his own Series,
+ // keeping the same 'Serie Instance UID' for various images
+ // The user shouldn't add any image to a 'Manufacturer Serie'
+ // but there is no way no to prevent him for doing that
+ CheckMandatoryEntry(0x0020,0x000e,Util::CreateUniqueUID());
+
+ // Study ID
+ CheckMandatoryEntry(0x0020,0x0010,"");
+
+ // Series Number
+ CheckMandatoryEntry(0x0020,0x0011,"");
+
+ // Instance Number
+ CheckMandatoryEntry(0x0020,0x0013,"");
+
+ // Patient Orientation
+ // Can be computed from (0020|0037) : Image Orientation (Patient)
+ gdcm::Orientation *o = gdcm::Orientation::New();
+ std::string ori = o->GetOrientation ( FileInternal );
+ o->Delete();
+ if (ori != "\\" )
+ CheckMandatoryEntry(0x0020,0x0020,ori);
+ else
+ CheckMandatoryEntry(0x0020,0x0020,"");
+
+ // Modality : if missing we set it to 'OTher'
+ CheckMandatoryEntry(0x0008,0x0060,"OT");
+
+ // Manufacturer : if missing we set it to 'GDCM Factory'
+ CheckMandatoryEntry(0x0008,0x0070,"GDCM Factory");
+
+ // Institution Name : if missing we set it to 'GDCM Hospital'
+ CheckMandatoryEntry(0x0008,0x0080,"GDCM Hospital");
+
+ // Patient's Name : if missing, we set it to 'GDCM^Patient'
+ CheckMandatoryEntry(0x0010,0x0010,"GDCM^Patient");
+
+ // Patient ID
+ CheckMandatoryEntry(0x0010,0x0020,"");
+
+ // Patient's Birth Date : 'type 2' entry -> must exist, value not mandatory
+ CheckMandatoryEntry(0x0010,0x0030,"");
+
+ // Patient's Sex :'type 2' entry -> must exist, value not mandatory
+ CheckMandatoryEntry(0x0010,0x0040,"");
+
+ // Referring Physician's Name :'type 2' entry -> must exist, value not mandatory
+ CheckMandatoryEntry(0x0008,0x0090,"");
+
+ // Remove some inconstencies (probably some more will be added)
+
+ // if (0028 0008)Number of Frames exists
+ // Push out (0020 0052),Frame of Reference UID
+ // (only meaningfull within a Serie)
+ DataEntry *e_0028_0008 = FileInternal->GetDataEntry(0x0028, 0x0008);
+ if ( !e_0028_0008 )
+ {
+ Archive->Push(0x0020, 0x0052);