]> Creatis software - gdcm.git/blobdiff - src/gdcmFile.cxx
To avoid valgring warning about shadowed local variable
[gdcm.git] / src / gdcmFile.cxx
index c1381c8621f169d66cc59927f4722cfa6b8607fa..c27a505a1769d6eeb695cc2198db3c56ce4ba52c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/17 11:02:47 $
-  Version:   $Revision: 1.225 $
+  Date:      $Date: 2005/03/02 17:18:32 $
+  Version:   $Revision: 1.228 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1411,12 +1411,18 @@ bool File::Write(std::string fileName, FileType writetype)
 // Protected
 /**
  * \brief Initialize a default DICOM File that should contain all the
- *        field require by other reader. DICOM standard does not 
+ *        fields required by other readers. DICOM standard does not 
  *        explicitely defines those fields, heuristic has been choosen.
- *        This is not perfect as we are writting a Secondary Capture image...
+ * \todo some more tests to be performed to avoid collisions 
+ *       with FileHelper::CheckMandatoryElements()
  */
 void File::InitializeDefaultFile()
 {
+
+/*
+  // CurrentTime will be set just before Writting
+  // whatever the source image is
+
    std::string date = Util::GetCurrentDate();
    std::string time = Util::GetCurrentTime();
    std::string uid  = Util::CreateUniqueUID();
@@ -1426,6 +1432,8 @@ void File::InitializeDefaultFile()
    std::string uidStudy = Util::CreateUniqueUID();
    std::string uidSerie = Util::CreateUniqueUID();
 
+ // Meta Elements are set just before writting
    // Meta Element Group Length
    InsertValEntry("146 ",                      0x0002, 0x0000);
    // Media Storage SOP Class UID (Secondary Capture Image Storage)
@@ -1438,9 +1446,18 @@ void File::InitializeDefaultFile()
    InsertValEntry(uidClass.c_str(),            0x0002, 0x0012);
    // Source Application Entity Title
    InsertValEntry("GDCM",                      0x0002, 0x0016);
+*/
+
+// Just to avoid further trouble if user asks to write the dile ACR-NEMA mode
+   InsertValEntry("", 0x0008, 0x0010); // Recognition Code (RET)
+
+/*
+// Dicom related entries must be set by the user
+// If they are missing, they are defaulted just bedfore writting
 
    // Instance Creation Date
    InsertValEntry(date.c_str(),                0x0008, 0x0012);
+
    // Instance Creation Time
    InsertValEntry(time.c_str(),                0x0008, 0x0013);
    // SOP Class UID
@@ -1448,16 +1465,18 @@ void File::InitializeDefaultFile()
    // SOP Instance UID
    InsertValEntry(uidInst.c_str(),             0x0008, 0x0018);
    // Modality    
-   InsertValEntry("CT",                        0x0008, 0x0060);
+   InsertValEntry("OT",                        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);
+   InsertValEntry("GDCM^patient",              0x0010, 0x0010);
    // Patient ID
    InsertValEntry("GDCMID",                    0x0010, 0x0020);
 
@@ -1467,13 +1486,18 @@ void File::InitializeDefaultFile()
    InsertValEntry(uidSerie.c_str(),            0x0020, 0x000e);
    // StudyID
    InsertValEntry("1",                         0x0020, 0x0010);
+
+  // Is 'Series number' mandatory ?
    // SeriesNumber
    InsertValEntry("1",                         0x0020, 0x0011);
 
+// None of these default value is meaningfull !
+// It *must be* up to the user to initialize them.
+
    // Samples per pixel 1 or 3
    InsertValEntry("1",                         0x0028, 0x0002);
    // photochromatic interpretation
-   InsertValEntry("MONOCHROME1",               0x0028, 0x0004);
+   InsertValEntry("MONOCHROME2",               0x0028, 0x0004);
    // nbRows
    InsertValEntry("0",                         0x0028, 0x0010);
    // nbCols
@@ -1487,11 +1511,17 @@ void File::InitializeDefaultFile()
    // Pixel Representation 0(unsigned) or 1(signed)
    InsertValEntry("0",                         0x0028, 0x0103);
 
+*/
+
+   // It should be up to the user to do that!
+
    // default value
    // Special case this is the image (not a string)
+
    GrPixel = 0x7fe0;
    NumPixel = 0x0010;
    InsertBinEntry(0, 0, GrPixel, NumPixel);
+
 }
 
 //-----------------------------------------------------------------------------