]> Creatis software - gdcm.git/blobdiff - Example/TestPapyrus.cxx
Normalization
[gdcm.git] / Example / TestPapyrus.cxx
index 31d0e274c8bac98e252c810b15e21c93aa62ed51..28ad2245086438220969e40e8f374fa1762ab6c2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestPapyrus.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/24 16:10:49 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/02/02 10:06:32 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -34,7 +34,7 @@
 #endif
 
 // return true if the file exists
-bool FileExists(const charfilename)
+bool FileExists(const char *filename)
 {
 #ifdef _MSC_VER
 # define access _access
@@ -52,7 +52,7 @@ bool FileExists(const char* filename)
     }
 }
 
-bool RemoveFile(const charsource)
+bool RemoveFile(const char *source)
 {
 #ifdef _MSC_VER
 #define _unlink unlink
@@ -68,7 +68,7 @@ bool RemoveFile(const char* source)
 // and we don't perform any integrity check
 // ----------------------------------------------------------------------
 
-int main(int argc, charargv[])
+int main(int argc, char *argv[])
 {
    if (argc < 3)
    {
@@ -81,7 +81,7 @@ int main(int argc, char* argv[])
    std::string output = argv[2];
 
    if (argc > 3)
-      gdcm::Debug::SetDebugOn();
+      gdcm::Debug::DebugOn();
 
    if( FileExists( output.c_str() ) )
    {
@@ -147,7 +147,6 @@ int main(int argc, char* argv[])
    // inside the loop
 
    // Get caracteristics of the first image
-
    SamplesPerPixel     = sqi->GetEntryValue(0x0028,0x0002);
    Rows                = sqi->GetEntryValue(0x0028,0x0010);
    Columns             = sqi->GetEntryValue(0x0028,0x0011);
@@ -165,20 +164,10 @@ int main(int argc, char* argv[])
    int lgrImage = iRows*iColumns * iSamplesPerPixel * (iBitsAllocated/8);
 
    // compute number of images
-
    int nbImages = seqPapyrus->GetNumberOfSQItems();
-/*
-   int nbImages = 0;
-   while (sqi)
-   {
-      nbImages++;
-      sqi =  seqPapyrus->GetNextSQItem();
-   }
-*/
    std::cout <<"Number of frames :" << nbImages << std::endl;  
 
    //  allocate enough room to get the pixels of all images.
-
    uint8_t *PixelArea = new uint8_t[lgrImage*nbImages];
    uint8_t *currentPosition = PixelArea;
   gdcm::BinEntry *pixels;
@@ -195,7 +184,7 @@ int main(int argc, char* argv[])
       return 0;
    }
    // to be sure to be at the beginning
-   Fp->seekg(0,  std::ios::end);
+   Fp->seekg(0, std::ios::end);
 
    uint32_t offset;
    std::string previousRows = Rows;
@@ -229,25 +218,24 @@ int main(int argc, char* argv[])
    std::string NumberOfFrames = gdcm::Util::Format("%d", nbImages); 
 
    gdcm::File *n = new gdcm::File();
-   n->InitializeDefaultFile();
 
-   n->ReplaceOrCreate(MediaStSOPinstUID,  0x0002,0x0002);
+   n->InsertValEntry(MediaStSOPinstUID,  0x0002,0x0002);
   // Whe keep default gdcm Transfer Syntax (Explicit VR Little Endian)
   // since using Papyrus one (Implicit VR Little Endian) is a mess
-   //n->ReplaceOrCreate(TransferSyntax,     0x0002,0x0010);
-   n->ReplaceOrCreate(StudyDate,          0x0008,0x0020);
-   n->ReplaceOrCreate(StudyTime,          0x0008,0x0030);
-   n->ReplaceOrCreate(Modality,           0x0008,0x0060);
-   n->ReplaceOrCreate(PatientName,        0x0010,0x0010);
-
-   n->ReplaceOrCreate(SamplesPerPixel,    0x0028,0x0002);
-   n->ReplaceOrCreate(NumberOfFrames,     0x0028,0x0008);
-   n->ReplaceOrCreate(Rows,               0x0028,0x0010);
-   n->ReplaceOrCreate(Columns,            0x0028,0x0011);
-   n->ReplaceOrCreate(BitsAllocated,      0x0028,0x0100);
-   n->ReplaceOrCreate(BitsStored,         0x0028,0x0101);
-   n->ReplaceOrCreate(HighBit,            0x0028,0x0102);
-   n->ReplaceOrCreate(PixelRepresentation,0x0028,0x0102);
+   //n->InsertValEntry(TransferSyntax,     0x0002,0x0010);
+   n->InsertValEntry(StudyDate,          0x0008,0x0020);
+   n->InsertValEntry(StudyTime,          0x0008,0x0030);
+   n->InsertValEntry(Modality,           0x0008,0x0060);
+   n->InsertValEntry(PatientName,        0x0010,0x0010);
+
+   n->InsertValEntry(SamplesPerPixel,    0x0028,0x0002);
+   n->InsertValEntry(NumberOfFrames,     0x0028,0x0008);
+   n->InsertValEntry(Rows,               0x0028,0x0010);
+   n->InsertValEntry(Columns,            0x0028,0x0011);
+   n->InsertValEntry(BitsAllocated,      0x0028,0x0100);
+   n->InsertValEntry(BitsStored,         0x0028,0x0101);
+   n->InsertValEntry(HighBit,            0x0028,0x0102);
+   n->InsertValEntry(PixelRepresentation,0x0028,0x0102);
 
    // create the file
    gdcm::FileHelper *file = new gdcm::FileHelper(n);