+//-----------------------------------------------------------------------------
+// Protected
+/**
+ * \brief Initialize a default DICOM File that should contain all the
+ * field require by other reader. DICOM standard does not
+ * explicitely defines those fields, heuristic has been choosen.
+ * This is not perfect as we are writting a CT image...
+ */
+void File::InitializeDefaultFile()
+{
+ std::string date = Util::GetCurrentDate();
+ std::string time = Util::GetCurrentTime();
+ std::string uid = Util::CreateUniqueUID();
+ std::string uidMedia = uid;
+ std::string uidInst = uid;
+ std::string uidClass = Util::CreateUniqueUID();
+ std::string uidStudy = Util::CreateUniqueUID();
+ std::string uidSerie = Util::CreateUniqueUID();
+
+ // Meta Element Group Length
+ InsertValEntry("146 ", 0x0002, 0x0000);
+ // Media Storage SOP Class UID (CT Image Storage)
+ InsertValEntry("1.2.840.10008.5.1.4.1.1.2", 0x0002, 0x0002);
+ // Media Storage SOP Instance UID
+ InsertValEntry(uidMedia.c_str(), 0x0002, 0x0003);
+ // Transfer Syntax UID (Explicit VR Little Endian)
+ InsertValEntry("1.2.840.10008.1.2.1 ", 0x0002, 0x0010);
+ // META Implementation Class UID
+ InsertValEntry(uidClass.c_str(), 0x0002, 0x0012);
+ // Source Application Entity Title
+ InsertValEntry("GDCM", 0x0002, 0x0016);
+
+ // Instance Creation Date
+ InsertValEntry(date.c_str(), 0x0008, 0x0012);
+ // Instance Creation Time
+ InsertValEntry(time.c_str(), 0x0008, 0x0013);
+ // SOP Class UID
+ InsertValEntry("1.2.840.10008.5.1.4.1.1.2", 0x0008, 0x0016);
+ // SOP Instance UID
+ InsertValEntry(uidInst.c_str(), 0x0008, 0x0018);
+ // Modality
+ InsertValEntry("CT", 0x0008, 0x0060);
+ // Manufacturer
+ InsertValEntry("GDCM", 0x0008, 0x0070);
+ // Institution Name
+ InsertValEntry("GDCM", 0x0008, 0x0080);
+ // Institution Address
+ InsertValEntry("http://www-creatis.insa-lyon.fr/Public/Gdcm", 0x0008, 0x0081);
+
+ // Patient's Name
+ InsertValEntry("GDCM", 0x0010, 0x0010);
+ // Patient ID
+ InsertValEntry("GDCMID", 0x0010, 0x0020);
+
+ // Study Instance UID
+ InsertValEntry(uidStudy.c_str(), 0x0020, 0x000d);
+ // Series Instance UID
+ InsertValEntry(uidSerie.c_str(), 0x0020, 0x000e);
+ // StudyID
+ InsertValEntry("1", 0x0020, 0x0010);
+ // SeriesNumber
+ InsertValEntry("1", 0x0020, 0x0011);
+
+ // Samples per pixel 1 or 3
+ InsertValEntry("1", 0x0028, 0x0002);
+ // photochromatic interpretation
+ InsertValEntry("MONOCHROME1", 0x0028, 0x0004);
+ // nbRows
+ InsertValEntry("0", 0x0028, 0x0010);
+ // nbCols
+ InsertValEntry("0", 0x0028, 0x0011);
+ // BitsAllocated 8 or 12 or 16
+ InsertValEntry("8", 0x0028, 0x0100);
+ // BitsStored <= BitsAllocated
+ InsertValEntry("8", 0x0028, 0x0101);
+ // HighBit <= BitsAllocated - 1
+ InsertValEntry("7", 0x0028, 0x0102);
+ // Pixel Representation 0(unsigned) or 1(signed)
+ InsertValEntry("0", 0x0028, 0x0103);
+
+ // default value
+ // Special case this is the image (not a string)
+ GrPixel = 0x7fe0;
+ NumPixel = 0x0010;
+ InsertBinEntry(0, 0, GrPixel, NumPixel);