]> Creatis software - gdcm.git/commitdiff
Update
authorjpr <jpr>
Thu, 6 Sep 2007 16:51:44 +0000 (16:51 +0000)
committerjpr <jpr>
Thu, 6 Sep 2007 16:51:44 +0000 (16:51 +0000)
Doc/Website/HowToUseGdcm.html

index 3c9ca52d1b90dd0cd296068bab25c28e0350f7f9..7817a2100dff8cc56205aaa450aacbb2541d2047 100755 (executable)
@@ -265,9 +265,20 @@ Check some fields, e.g
 
 Next step is to load the pixels in memory.
 Uncompression (JPEG lossless, JPEG lossy, JPEG 2000, RLE, ...) 
-is automatically performed if necessary.
+will be automatically performed if necessary.
+
+You first have to create a 'File Helper'
 
            gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
+
+In some images,(where BitsAllocated=16, BitsUsed=8), 
+the 'unused bits' are actually ... used for storing 'overlays'.
+(e.g. : Patient / Aquisition / Institution informations, or drawings ...)
+It's up to you to decide whether you want or not to load the overlays.
+(Probabely, if you want to post-process the images, you dont' want!)
+
+           fh->SetKeepOverlays(true);  // default is : false
+
            void *imageData = fh->GetImageDataRaw();
            uint32_t dataSize = fh->GetImageDataRawSize();
 
@@ -292,8 +303,6 @@ Possible values are :
            int dimZ = f->GetZSize(); // meaningfull only for 'Volumes' or 'multiframe files'
            int dimT = f->GetTSize(); // meaningfull only for 4D objects (?)
 
-Now, you can enjoy your image !
-
 Sometimes, you deal with 'colour' images :-(
 They may be stored, on disc, as :
      RGB pixels, 
@@ -312,6 +321,8 @@ If you don't want to convert a "Grey level images + LUT" into "RGB Pixel image"
            gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
            void *imageData = fh->GetImageDataRaw();
            uint32_t dataSize = fh->GetImageDataRawSize();
+   
+Now, you can enjoy your image !   
 
 1-1-1-3) Get the value of a single Dicom DataElement 
 
@@ -383,7 +394,7 @@ Files are 'splitted' into as many 'Single Serie UID File Set'
 // -------- skip this one, for a first reading ! -----------
 
 Sometimes, the Serie UID is not enough to disseminate properly the images.
-We may want to disseminate into multiple sub serie when needed.
+We may want to disseminate into multiple sub series when needed.
 
 Use :
 void SerieHelper::SetUseSeriesDetails(bool s);
@@ -535,10 +546,12 @@ a vtkGdcmReader() method ( derived from vtkReader() ) is available.
 
    vtkGdcmReader *reader = vtkGdcmReader::New();
    reader->SetFileName( yourDicomFilename );      
-   reader->SetLoadMode( yourLoadMode); // See C++ part 
+   reader->SetLoadMode( yourLoadMode);   // See C++ part 
+   reader->SetKeepOverlays( true/false); // See C++ part    
    reader->Update();
    vtkImageData* ima = reader->GetOutput();
-   int* Size = ima->GetDimensions();   
+   int* Size = ima->GetDimensions(); 
+     
  // -> Enjoy it.     
 
 1-2-2) A File Set
@@ -550,10 +563,12 @@ feel like:
    vtkGdcmReader *reader = vtkGdcmReader::New();
    for(int i=1; i< yourNumberOfFiles; i++)
          reader->AddFileName( yourTableOfFileNames[i] );     
-   reader->SetLoadMode( yourLoadMode); // See C++ part 
+   reader->SetLoadMode( yourLoadMode);   // See C++ part 
+   reader->SetKeepOverlays( true/false); // See C++ part     
    reader->Update();
    vtkImageData* ima = reader->GetOutput();
    int* Size = ima->GetDimensions();
+   
  // -> Enjoy it.
  
  Warning : The first file is assumed to be the reference file.
@@ -695,7 +710,7 @@ you just have to process as follow :
         file->InsertEntryString(str.str(),0x0028,0x0002, "US"); // Samples per Pixel
 
 //--> Set Optional fields
-      se further how to deal with optional fields
+      see further how to deal with optional fields
 
 //--> Create a gdcm::FileHelper
        gdcm::FileHelper *fileH = gdcm::FileHelper::New(file);
@@ -729,8 +744,8 @@ you just have to process as follow :
       // depending on what you did before!
 
 //--> Set the compression type : 
-      fileH->SetWriteTypeToJPEG();      // lossles compression        
-      fileH->SetWriteTypeToJPEG2000();  // lossles compression 
+      fileH->SetWriteTypeToJPEG();      // lossless compression        
+      fileH->SetWriteTypeToJPEG2000();  // lossless compression 
       fileH->SetWriteTypeToDcmExplVR(); // Explicit Value Representation (no compression)
       fileH->SetWriteTypeToDcmImplVR(); // Implicit Value Representation (no compression)
       
@@ -742,13 +757,16 @@ you just have to process as follow :
       // It doesn't change the values. )
       // or
        fileH->SetUserData((unsigned char *)imageData,size); // performs compression, when required
-            
+      // ( Casting as 'unsigned char *' is just to avoid warnings.
+      // It doesn't change the values. )
+                  
 //-> Write !      
       fileH->Write(fileName.str());
 
 //This works for a single image (singleframe or multiframe)
 
 2-1-1-1) Deal with optional DataElements          // TODO : finish it
+
     Any Data Element may be added (it's up to the user to understand what he is doing!)
     The supplied methods 'InsertXxx' will create the DataElement or replace it if it already exists.  
     Have a look at gdcm/Dict/dicomV3.dic to see what are the various DICOM fields, with their VR.
@@ -808,7 +826,8 @@ you just have to process as follow :
    // gdcm::FileHelper::CheckMandatoryElements() will check inconsistencies,
    // as far as it knows how.
    // Sorry, not yet available under Python.
-   //vtkSetMacro(GdcmFile, gdcm::File *);
+   
+     vtkSetMacro(GdcmFile, gdcm::File *);
    
 void vtkGdcmWriter::SetGdcmFile(gdcm::File *);
 
@@ -836,7 +855,7 @@ void vtkGdcmWriter::SetContentTypeToFilteredImage()
 void vtkGdcmWriter::SetContentTypeToUserCreatedImage()                        
 vtkGdcmWriter::void SetContentTypeToUnmodifiedPixelsImage()
    
-  // depending on what he did before!
+  // depending on what he did before (see C++ part)