]> Creatis software - gdcm.git/commitdiff
- now Write drops LUT Descriptors and LUTs (if any) when SamplesPerPixel =3
authorjpr <jpr>
Mon, 28 Jun 2004 09:30:58 +0000 (09:30 +0000)
committerjpr <jpr>
Mon, 28 Jun 2004 09:30:58 +0000 (09:30 +0000)
- now Write is no longer confused by 'BitsAllocated = 12" and 'BitsStored=12"

+ Tabs hunting

src/gdcmDicomDir.cxx
src/gdcmDirList.cxx
src/gdcmDocEntry.cxx
src/gdcmDocument.cxx
src/gdcmDocument.h
src/gdcmHeader.cxx
src/gdcmHeader.h
src/gdcmJpeg.cxx
src/gdcmJpeg12.cxx
src/gdcmJpeg2000.cxx
src/gdcmVR.cxx

index 7fbc137c187952a3e690a05ee07aa930f246ef4d..7a18df16f7d28230eda48d4c2e06238e89678b5a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 13:02:36 $
-  Version:   $Revision: 1.52 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.53 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -405,7 +405,6 @@ void gdcmDicomDir::WriteEntries(FILE *) //_fp
 void gdcmDicomDir::CreateDicomDirChainedList(std::string path)
 {
    CallStartMethod();
-
    gdcmDirList fileList(path,1); // gets recursively the file list
    unsigned int count=0;
    VectDocument list;
@@ -418,18 +417,26 @@ void gdcmDicomDir::CreateDicomDirChainedList(std::string path)
                              it!=fileList.end(); 
                              ++it) 
    {
+      std::cout << "nom fichier " << it->c_str() << std::endl; //JPR
+
       progress=(float)(count+1)/(float)fileList.size();
       CallProgressMethod();
       if(abort)
-         break;
+          break;
 
       header=new gdcmHeader(it->c_str());
-      if(header->IsReadable())
+      if(!header) {
+         std::cout << "echec new Header " << it->c_str() << std::endl; // JPR
+      }
+      if(header->IsReadable()) {
          list.push_back(header);  // adds the file header to the chained list
+         std::cout << "readable : " <<it->c_str() << std::endl;
+       }
       else
          delete header;
 
       count++;
+
    }
    // sorts Patient/Study/Serie/
    std::sort(list.begin(),list.end(),gdcmDicomDir::HeaderLessThan);
index e30f633728778482278b0bd9a99bff737d5fdd9c..efdc939369ee3cf2ad6a3c1f54ca4728631fa8a0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDirList.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/20 18:08:47 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.17 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -84,7 +84,6 @@ std::string gdcmDirList::GetDirName(void)
 void gdcmDirList::Explore(std::string dirName,bool recursive)
 {
    std::string fileName;
-
    NormalizePath(dirName);
 #if defined(_MSC_VER) || (__CYGWIN__)
    WIN32_FIND_DATA fileData; 
index 69d07b069fb97817be3d4b1d21b653805abc9f9b..0a55cb640ff1cb32b93c4271c4572a481f835ad4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/24 18:03:14 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -146,6 +146,7 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
 
       guint16 z=0;
       guint16 shortLgr = lgr;
+
       if (vr == "unkn") {     // Unknown was 'written'
          // deal with Little Endian            
          fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp);
index 6080c6efacdc4a04216473e9e0050088582034de..74f0069e75321c7912585a8cd92b860086b8de8b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/25 19:37:05 $
-  Version:   $Revision: 1.35 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.36 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -74,8 +74,7 @@
 const unsigned int gdcmDocument::HEADER_LENGTH_TO_READ = 256;
 
 // Refer to gdcmDocument::SetMaxSizeLoadEntry()
-const unsigned int gdcmDocument::MAX_SIZE_LOAD_ELEMENT_VALUE = 0x7fffffff;// 4096;
-
+const unsigned int gdcmDocument::MAX_SIZE_LOAD_ELEMENT_VALUE = 0x7fffffff;// 4096;//
 const unsigned int gdcmDocument::MAX_SIZE_PRINT_ELEMENT_VALUE = 0x7fffffff;//64;
 
 //-----------------------------------------------------------------------------
@@ -263,10 +262,12 @@ bool gdcmDocument::SetShaDict(DictKey dictName){
  */
 bool gdcmDocument::IsReadable(void) { 
    if(Filetype==gdcmUnknown) {
+      //std::cout << " gdcmDocument::IsReadable: Filetype " << Filetype
+      //         << " " << "gdcmUnknown " << gdcmUnknown << std::endl; //JPR
       dbg.Verbose(0, "gdcmDocument::IsReadable: wrong filetype");
       return false;
    }
-   if(!tagHT.empty()<=0) { 
+   if(tagHT.empty()) { 
       dbg.Verbose(0, "gdcmDocument::IsReadable: no tags in internal"
                      " hash table.");
       return false;
@@ -558,13 +559,71 @@ void gdcmDocument::Write(FILE* fp,FileType filetype) {
       SetEntryLengthByNumber(20, 0x0002, 0x0010);
    }
 
+// TODO : move to gdcmHeader::Write
+// -----------------------------------------------------
+   // Bits Allocated
+   if ( GetEntryByNumber(0x0028,0x0100) ==  "12") {
+      SetEntryByNumber("16", 0x0028,0x0100);
+   }
+
+  // correct Pixel group Length if necessary
+
+   guint16 GrPixel  = 0x7fe0;
+   guint16 NumPixel = 0x0010;
+
+   // TODO : create a gdcmHeader::Write method and move this part.
+   //        (only gdcmHeader knows GrPixel, NumPixel)
+
+   int i_lgPix = GetEntryLengthByNumber(GrPixel, NumPixel);
+   if (i_lgPix != -2) { // no (GrPixel, NumPixel) element
+      char * dumm = new char[20];
+      sprintf(dumm ,"%d", i_lgPix+12);
+      std::string s_lgPix = dumm;
+      delete dumm;
+      ReplaceOrCreateByNumber(s_lgPix,GrPixel, 0x0000);
+   }
+
+   // Drop Palette Color, if necessary
+   
+   // FIXME : Why is it always false ???
+
+   // std::cout << "entry 0x0028,0x0002 " << GetEntryByNumber(0x0028,0x0002).c_str() << std::endl;
+
+ /*  if ( GetEntryByNumber(0x0028,0x0002).c_str() == "3" ) */{
+    
+    // Drop 0028|1101, 0028|1102, 0028|1103
+    // Drop 0028|1201, 0028|1202, 0028|1203
+
+      gdcmDocEntry *e;
+      e=GetDocEntryByNumber(0x0028,0x01101);
+      if (e) 
+         RemoveEntry(e);
+      e=GetDocEntryByNumber(0x0028,0x1102);
+      if (e) 
+         RemoveEntry(e);
+      e=GetDocEntryByNumber(0x0028,0x1103);
+
+      if (e) 
+         RemoveEntry(e);
+      e=GetDocEntryByNumber(0x0028,0x01201);
+      if (e) 
+         RemoveEntry(e);
+      e=GetDocEntryByNumber(0x0028,0x1202);
+     if (e) 
+         RemoveEntry(e);
+      e=GetDocEntryByNumber(0x0028,0x1203);
+     if (e) 
+         RemoveEntry(e);
+ } 
+
+// ----------- end move to gdcmHeader::Write -----------------
+  
 /**
  * \todo rewrite later, if really usefull
  *               ('Group Length' element is optional in DICOM)
  *
  *       --> Warning : un-updated odd groups lengthes can causes pb
- *       -->           (xmedcon breaks)
- *       --> to be re- written with future org.
+ *       -->           (xmedcon breaker)
  *
  * if ( (filetype == ImplicitVR) || (filetype == ExplicitVR) )
  *    UpdateGroupLength(false,filetype);
@@ -572,9 +631,8 @@ void gdcmDocument::Write(FILE* fp,FileType filetype) {
  *    UpdateGroupLength(true,ACR);
  */
  
-   gdcmElementSet::Write(fp,filetype); 
+   gdcmElementSet::Write(fp,filetype); // This one is recursive
 
-  // return true;
 }
 
 /**
@@ -1210,7 +1268,7 @@ long gdcmDocument::ParseDES(gdcmDocEntrySet *set, long offset, long l_max, bool
       NewDocEntry = ReadNextDocEntry( );
       if (!NewDocEntry)
          break;
-
+     // NewDocEntry->Print(); cout << endl; //JPR
       vr = NewDocEntry->GetVR();
       if (vr!="SQ")
       {
index c5354856ad626e8ac6548639e15ddf731efd6c89..6b757e27b5c3b4bb080f17526d874c372ebf4b56 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/25 17:48:45 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.17 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -238,7 +238,6 @@ private:
    void SetMaxSizeLoadEntry(long);
    void SetMaxSizePrintEntry(long);
 
    // DocEntry related utilities
    gdcmDocEntry *ReadNextDocEntry   ();
 
index 9a3e9cf531243ac674e2e7b0b23a71a048e2c2ba..a3e68cec9f572f7c25258e2af5e8d320501f7f35 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 09:30:22 $
-  Version:   $Revision: 1.169 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.170 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -103,6 +103,7 @@ gdcmHeader::~gdcmHeader () {
  */
 bool gdcmHeader::IsReadable() {
    if(!gdcmDocument::IsReadable()) {
+      //std::cout << "doc non Readable " << std::endl; //JPR
       return false;
    }
    std::string res = GetEntryByNumber(0x0028, 0x0005);
index bbb940c0a22aa3db3817e9c460d94c0372ebb479..e67769cde3d89dddae4f47af9f46baebbb3936db 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 03:36:24 $
-  Version:   $Revision: 1.77 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.78 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -125,7 +125,6 @@ public:
    int GetPlanarConfiguration();
    int GetPixelSize();
 
-   int GetPixelSizeGetPixelType();
    std::string GetPixelType();
    size_t GetPixelOffset();
    size_t GetPixelAreaLength();
index 123f68e1c1083f603075cfb0cee205b74ea7c775..fbfe8de15d823e12e4584633c91b712dad968aa7 100644 (file)
@@ -5,8 +5,6 @@
 
 #define BITS_IN_JSAMPLE 8
 
-#define GDCM_jpr_DEBUG 0
-
 /*
 DICOM provides a mechanism for supporting the use of JPEG Image Compression 
 through the Encapsulated Format (see PS 3.3 of the DICOM Standard). 
@@ -120,8 +118,8 @@ extern "C" {
 
 //-----------------------------------------------------------------------------
 struct my_error_mgr {
-   struct jpeg_error_mgr pub;  /* "public" fields */
-   jmp_buf setjmp_buffer;      /* for return to caller */
+   struct jpeg_error_mgr pub; /* "public" fields */
+   jmp_buf setjmp_buffer;     /* for return to caller */
 };
 
 //-----------------------------------------------------------------------------
@@ -166,11 +164,11 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
    struct jpeg_decompress_struct cinfo;
 
    /* -------------- inside, we found :
-    * JDIMENSION image_width;  // input image width 
-    * JDIMENSION image_height; // input image height 
-    * int input_components;            // nb of color components in input image 
-    * J_COLOR_SPACE in_color_space;    // colorspace of input image 
-    * double input_gamma;              // image gamma of input image 
+    * JDIMENSION image_width;       // input image width 
+    * JDIMENSION image_height;      // input image height 
+    * int input_components;         // nb of color components in input image 
+    * J_COLOR_SPACE in_color_space; // colorspace of input image 
+    * double input_gamma;           // image gamma of input image 
     * -------------- */
 
    /* We use our private extension JPEG error handler.
@@ -180,20 +178,20 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
    struct my_error_mgr jerr;
    /* More stuff */
 
-   JSAMPARRAY buffer;          /* Output row buffer */
+   JSAMPARRAY buffer;/* Output row buffer */
   
    // rappel :
    // ------
    // typedef unsigned char JSAMPLE;
-   // typedef JSAMPLE FAR *JSAMPROW;   /* ptr to one image row of pixel samples. */
-   // typedef JSAMPROW *JSAMPARRAY;    /* ptr to some rows (a 2-D sample array) */
-   // typedef JSAMPARRAY *JSAMPIMAGE;  /* a 3-D sample array: top index is color */
+   // typedef JSAMPLE FAR *JSAMPROW;/* ptr to one image row of pixel samples. */
+   // typedef JSAMPROW *JSAMPARRAY;/* ptr to some rows (a 2-D sample array) */
+   // typedef JSAMPARRAY *JSAMPIMAGE;/* a 3-D sample array: top index is color */
 
-   int row_stride;             /* physical row width in output buffer */
+   int row_stride;/* physical row width in output buffer */
   
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("entree dans gdcmFile::gdcm_read_JPEG_file12, depuis gdcmJpeg\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* In this example we want to open the input file before doing anything else,
     * so that the setjmp() error recovery below can assume the file is open.
@@ -202,9 +200,9 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
     */
     
   /* Step 1: allocate and initialize JPEG decompression object */  
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
   printf("Entree Step 1\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
   
   /* We set up the normal JPEG error routines, then override error_exit. */
   
@@ -223,16 +221,16 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
   jpeg_create_decompress(&cinfo);
 
    /* Step 2: specify data source (eg, a file) */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
   printf("Entree Step 2\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    jpeg_stdio_src(&cinfo, fp);
 
    /* Step 3: read file parameters with jpeg_read_header() */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
   printf("Entree Step 3\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    (void) jpeg_read_header(&cinfo, TRUE);
    
@@ -242,7 +240,7 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
     * See libjpeg.doc for more info.
     */
 
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
       printf("--------------Header contents :----------------\n");
       printf("image_width %d image_height %d\n", 
               cinfo.image_width , cinfo.image_height);
@@ -250,30 +248,30 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
               cinfo.output_components);
       printf("nb of color components returned  %d \n", 
               cinfo.data_precision);
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
 
    /*
-    * JDIMENSION image_width;  // input image width 
-    * JDIMENSION image_height; // input image height 
-    * int output_components;   // # of color components returned 
-    * J_COLOR_SPACE in_color_space;    // colorspace of input image 
-    * double input_gamma;              // image gamma of input image
-    * int data_precision;              // bits of precision in image data 
+    * JDIMENSION image_width;       // input image width 
+    * JDIMENSION image_height;      // input image height 
+    * int output_components;        // # of color components returned 
+    * J_COLOR_SPACE in_color_space; // colorspace of input image 
+    * double input_gamma;           // image gamma of input image
+    * int data_precision;           // bits of precision in image data 
     */
 
    /* Step 4: set parameters for decompression */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
   printf("Entree Step 4\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
    /* In this example, we don't need to change any of the defaults set by
     * jpeg_read_header(), so we do nothing here.
     */
 
    /* Step 5: Start decompressor */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 5\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    (void) jpeg_start_decompress(&cinfo);
    /* We can ignore the return value since suspension is not possible
@@ -290,28 +288,28 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
    /* JSAMPLEs per row in output buffer */
    row_stride = cinfo.output_width * cinfo.output_components;
   
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
   printf ("cinfo.output_width %d cinfo.output_components %d  row_stride %d\n",
                       cinfo.output_width, cinfo.output_components,row_stride);
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* Make a one-row-high sample array that will go away when done with image */
    buffer = (*cinfo.mem->alloc_sarray)
             ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
 
    /* Step 6: while (scan lines remain to be read) */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
     printf("Entree Step 6\n"); 
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
    /*           jpeg_read_scanlines(...); */
 
    /* Here we use the library's state variable cinfo.output_scanline as the
     * loop counter, so that we don't have to keep track ourselves.
     */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
       printf ("cinfo.output_height %d  cinfo.output_width %d\n",
                cinfo.output_height,cinfo.output_width);
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
    pimage=(char *)image_buffer;
   
    while (cinfo.output_scanline < cinfo.output_height) {
@@ -338,9 +336,9 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
   }
  
   /* Step 7: Finish decompression */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 7\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    (void) jpeg_finish_decompress(&cinfo);
    
@@ -350,9 +348,9 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
 
    /* Step 8: Release JPEG decompression object */
 
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
   printf("Entree Step 8\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* This is an important step since it will release a good deal of memory. */
 
@@ -398,4 +396,4 @@ bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
  * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
  */
  
-//-----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
index 294ab89db28e3945fe3cb77d6b2ec4c77514e178..ab04c32fa9468ff4e4832ffaff6eb1842a4c62fd 100644 (file)
@@ -5,7 +5,6 @@
 
 #define BITS_IN_JSAMPLE 12
 
-#define GDCM_jpr_DEBUG 0
 // BITS_IN_JSAMPLE is a compile time defined options.
 // We need both 8 an 12;
 // To avoid renaming *all* the Jpeg functions,
 // For all the functions, we shall have the 8 and 12 version
 // (8 with the 'long' name, 12 with the 'short' name)
 
-#define jpeg_read_header       jReadHeader
+#define jpeg_read_header        jReadHeader
 #define my_error_exit           myErrorExit
-#define jpeg_destroy_decompress        jDestDecompress
-#define jpeg_stdio_src         jStdSrc
-#define jpeg_read_header       jReadHeader
-#define jpeg_read_scanlines    jReadScanlines
-#define jpeg_finish_decompress jFinDecompress
+#define jpeg_destroy_decompress jDestDecompress
+#define jpeg_stdio_src          jStdSrc
+#define jpeg_read_header        jReadHeader
+#define jpeg_read_scanlines     jReadScanlines
+#define jpeg_finish_decompress  jFinDecompress
 //#define jpeg_create_decompress  jCreaDecompress //FIXME
 
 // -----------------
-#define jpeg_std_error         jStdError
-#define jpeg_CreateCompress    jCreaCompress
-#define jpeg_CreateDecompress  jCreaDecompress
-#define jpeg_destroy_compress  jDestCompress
-#define jpeg_destroy_decompress        jDestDecompress
-#define jpeg_stdio_dest                jStdDest
-#define jpeg_stdio_src         jStdSrc
-#define jpeg_set_defaults      jSetDefaults
-#define jpeg_set_colorspace    jSetColorspace
-#define jpeg_default_colorspace        jDefColorspace
-#define jpeg_set_quality       jSetQuality
-#define jpeg_set_linear_quality        jSetLQuality
-#define jpeg_add_quant_table   jAddQuantTable
-#define jpeg_quality_scaling   jQualityScaling
-#define jpeg_simple_progression        jSimProgress
-#define jpeg_suppress_tables   jSuppressTables
-#define jpeg_alloc_quant_table jAlcQTable
-#define jpeg_alloc_huff_table  jAlcHTable
-#define jpeg_start_compress    jStrtCompress
-#define jpeg_write_scanlines   jWrtScanlines
-#define jpeg_finish_compress   jFinCompress
-#define jpeg_write_raw_data    jWrtRawData
-#define jpeg_write_marker      jWrtMarker
-#define jpeg_write_m_header    jWrtMHeader
-#define jpeg_write_m_byte      jWrtMByte
-#define jpeg_write_tables      jWrtTables
-#define jpeg_read_header       jReadHeader
-#define jpeg_start_decompress  jStrtDecompress
-#define jpeg_read_scanlines    jReadScanlines
-#define jpeg_finish_decompress jFinDecompress
-#define jpeg_read_raw_data     jReadRawData
-#define jpeg_has_multiple_scans        jHasMultScn
-#define jpeg_start_output      jStrtOutput
-#define jpeg_finish_output     jFinOutput
-#define jpeg_input_complete    jInComplete
-#define jpeg_new_colormap      jNewCMap
-#define jpeg_consume_input     jConsumeInput
-#define jpeg_calc_output_dimensions    jCalcDimensions
-#define jpeg_save_markers      jSaveMarkers
-#define jpeg_set_marker_processor      jSetMarker
-#define jpeg_read_coefficients jReadCoefs
-#define jpeg_write_coefficients        jWrtCoefs
-#define jpeg_copy_critical_parameters  jCopyCrit
-#define jpeg_abort_compress    jAbrtCompress
-#define jpeg_abort_decompress  jAbrtDecompress
-#define jpeg_abort             jAbort
-#define jpeg_destroy           jDestroy
-#define jpeg_resync_to_restart jResyncRestart
+#define jpeg_std_error           jStdError
+#define jpeg_CreateCompress      jCreaCompress
+#define jpeg_CreateDecompress    jCreaDecompress
+#define jpeg_destroy_compress    jDestCompress
+#define jpeg_destroy_decompress  jDestDecompress
+#define jpeg_stdio_dest          jStdDest
+#define jpeg_stdio_src           jStdSrc
+#define jpeg_set_defaults        jSetDefaults
+#define jpeg_set_colorspace      jSetColorspace
+#define jpeg_default_colorspace  jDefColorspace
+#define jpeg_set_quality         jSetQuality
+#define jpeg_set_linear_quality  jSetLQuality
+#define jpeg_add_quant_table     jAddQuantTable
+#define jpeg_quality_scaling     jQualityScaling
+#define jpeg_simple_progression  jSimProgress
+#define jpeg_suppress_tables     jSuppressTables
+#define jpeg_alloc_quant_table   jAlcQTable
+#define jpeg_alloc_huff_table    jAlcHTable
+#define jpeg_start_compress      jStrtCompress
+#define jpeg_write_scanlines     jWrtScanlines
+#define jpeg_finish_compress     jFinCompress
+#define jpeg_write_raw_data      jWrtRawData
+#define jpeg_write_marker        jWrtMarker
+#define jpeg_write_m_header      jWrtMHeader
+#define jpeg_write_m_byte        jWrtMByte
+#define jpeg_write_tables        jWrtTables
+#define jpeg_read_header         jReadHeader
+#define jpeg_start_decompress    jStrtDecompress
+#define jpeg_read_scanlines      jReadScanlines
+#define jpeg_finish_decompress   jFinDecompress
+#define jpeg_read_raw_data       jReadRawData
+#define jpeg_has_multiple_scans  jHasMultScn
+#define jpeg_start_output        jStrtOutput
+#define jpeg_finish_output       jFinOutput
+#define jpeg_input_complete      jInComplete
+#define jpeg_new_colormap        jNewCMap
+#define jpeg_consume_input          jConsumeInput
+#define jpeg_calc_output_dimensions jCalcDimensions
+#define jpeg_save_markers           jSaveMarkers
+#define jpeg_set_marker_processor   jSetMarker
+#define jpeg_read_coefficients      jReadCoefs
+#define jpeg_write_coefficients     jWrtCoefs
+#define jpeg_copy_critical_parameters jCopyCrit
+#define jpeg_abort_compress      jAbrtCompress
+#define jpeg_abort_decompress    jAbrtDecompress
+#define jpeg_abort               jAbort
+#define jpeg_destroy             jDestroy
+#define jpeg_resync_to_restart   jResyncRestart
 
 /*
  * <setjmp.h> is used for the optional error recovery mechanism shown in
@@ -131,8 +130,8 @@ extern "C" {
 
 //-----------------------------------------------------------------------------
 struct my_error_mgr {
-   struct jpeg_error_mgr pub;  /* "public" fields */
-   jmp_buf setjmp_buffer;      /* for return to caller */
+   struct jpeg_error_mgr pub;   /* "public" fields */
+   jmp_buf setjmp_buffer;       /* for return to caller */
 };
 
 //-----------------------------------------------------------------------------
@@ -178,11 +177,11 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
    struct jpeg_decompress_struct cinfo;
   
    /* -------------- inside, we found :
-    * JDIMENSION image_width;  // input image width 
-    * JDIMENSION image_height; // input image height 
-    * int input_components;            // nb of color components in input image 
-    * J_COLOR_SPACE in_color_space;    // colorspace of input image 
-    * double input_gamma;              // image gamma of input image 
+    * JDIMENSION image_width;      // input image width 
+    * JDIMENSION image_height;     // input image height 
+    * int input_components;        // nb of color components in input image 
+    * J_COLOR_SPACE in_color_space;// colorspace of input image 
+    * double input_gamma;          // image gamma of input image 
     * -------------- */
   
    /* We use our private extension JPEG error handler.
@@ -192,19 +191,19 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
    struct my_error_mgr jerr;
    /* More stuff */
 
-   JSAMPARRAY buffer;          /* Output row buffer */
+   JSAMPARRAY buffer;/* Output row buffer */
 
    // rappel :
    // ------
    // typedef unsigned char JSAMPLE;
-   // typedef JSAMPLE FAR *JSAMPROW;   /* ptr to one image row of pixel samples. */
-   // typedef JSAMPROW *JSAMPARRAY;    /* ptr to some rows (a 2-D sample array) */
-   // typedef JSAMPARRAY *JSAMPIMAGE;  /* a 3-D sample array: top index is color */
+   // typedef JSAMPLE FAR *JSAMPROW;/* ptr to one image row of pixel samples. */
+   // typedef JSAMPROW *JSAMPARRAY;/* ptr to some rows (a 2-D sample array) */
+   // typedef JSAMPARRAY *JSAMPIMAGE;/* a 3-D sample array: top index is color */
 
-   int row_stride;             /* physical row width in output buffer */
-#ifdef GDCM_jpr_DEBUG
+   int row_stride;/* physical row width in output buffer */
+#ifdef GDCM_JPG_DEBUG
    printf("entree dans gdcmFile::gdcm_read_JPEG_file12, depuis gdcmJpeg\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* In this example we want to open the input file before doing anything else,
     * so that the setjmp() error recovery below can assume the file is open.
@@ -213,9 +212,9 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
     */
 
    /* Step 1: allocate and initialize JPEG decompression object */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 1\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* We set up the normal JPEG error routines, then override error_exit. */
 
@@ -235,15 +234,15 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
    jpeg_create_decompress(&cinfo);
 
    /* Step 2: specify data source (eg, a file) */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 2\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
    jpeg_stdio_src(&cinfo, fp);
 
    /* Step 3: read file parameters with jpeg_read_header() */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 3\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
    (void) jpeg_read_header(&cinfo, TRUE);
 
    /* We can ignore the return value from jpeg_read_header since
@@ -252,7 +251,7 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
     * See libjpeg.doc for more info.
     */
 
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
       printf("--------------Header contents :----------------\n");
       printf("image_width %d image_height %d\n", 
               cinfo.image_width , cinfo.image_height);
@@ -260,31 +259,31 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
               cinfo.output_components);
       printf("nb of color components returned  %d \n", 
               cinfo.data_precision);
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
 
    /*
-    * JDIMENSION image_width;  // input image width 
-    * JDIMENSION image_height; // input image height 
-    * int output_components;   // # of color components returned 
-    * J_COLOR_SPACE in_color_space;    // colorspace of input image 
-    * double input_gamma;              // image gamma of input image
-    * int data_precision;              // bits of precision in image data 
+    * JDIMENSION image_width;       // input image width 
+    * JDIMENSION image_height;      // input image height 
+    * int output_components;        // # of color components returned 
+    * J_COLOR_SPACE in_color_space; // colorspace of input image 
+    * double input_gamma;           // image gamma of input image
+    * int data_precision;           // bits of precision in image data 
     */
 
    /* Step 4: set parameters for decompression */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 4\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* In this example, we don't need to change any of the defaults set by
     * jpeg_read_header(), so we do nothing here.
     */
 
    /* Step 5: Start decompressor */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 5\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    (void) jpeg_start_decompress(&cinfo);
    /* We can ignore the return value since suspension is not possible
@@ -301,19 +300,19 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
    /* JSAMPLEs per row in output buffer */
    row_stride = cinfo.output_width * cinfo.output_components;
   
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
       printf ("cinfo.output_width %d cinfo.output_components %d  row_stride %d\n",
               cinfo.output_width, cinfo.output_components,row_stride);
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* Make a one-row-high sample array that will go away when done with image */
    buffer = (*cinfo.mem->alloc_sarray)
-           ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+    ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
 
    /* Step 6: while (scan lines remain to be read) */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 6\n"); 
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /*           jpeg_read_scanlines(...); */
 
@@ -321,10 +320,10 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
     * loop counter, so that we don't have to keep track ourselves.
     */
 
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf ("cinfo.output_height %d  cinfo.output_width %d\n",
-                      cinfo.output_height,cinfo.output_width);
-#endif //GDCM_jpr_DEBUG
+      cinfo.output_height,cinfo.output_width);
+#endif //GDCM_JPG_DEBUG
 
    pimage=(char *)image_buffer;
 
@@ -346,18 +345,18 @@ bool gdcmFile::gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer) {
    }
  
   /* Step 7: Finish decompression */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 7\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
    (void) jpeg_finish_decompress(&cinfo);
    /* We can ignore the return value since suspension is not possible
     * with the stdio data source.
     */
 
    /* Step 8: Release JPEG decompression object */
-#ifdef GDCM_jpr_DEBUG
+#ifdef GDCM_JPG_DEBUG
    printf("Entree Step 8\n");
-#endif //GDCM_jpr_DEBUG
+#endif //GDCM_JPG_DEBUG
 
    /* This is an important step since it will release a good deal of memory. */
    jpeg_destroy_decompress(&cinfo);
index bbfed9489c56751c4e7005117b390a22fb8b2283..1869296c12b2813a6cba580afc21d719eef22c21 100644 (file)
@@ -15,8 +15,8 @@
  */
 
 bool gdcmFile::gdcm_read_JPEG2000_file (FILE *fp,void * image_buffer) {
-   (void)fp;   //FIXME
-        (void)image_buffer;    //FIXME
+   (void)fp;                  //FIXME
+   (void)image_buffer;        //FIXME
    printf("Sorry JPEG 2000 File not yet taken into account\n");
    return false;
 }
index dbe4d2d5f109ccd79e5afc26bce7f7b0d74ea5c4..bf12afe851d0a8db6bd585007fcf8e8211061e38 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVR.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/20 18:08:48 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2004/06/28 09:30:58 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -136,7 +136,7 @@ bool gdcmVR::IsVROfGdcmStringRepresentable(VRKey tested)
        tested == "UI" || tested == "TM" || tested == "SH" || tested == "LO" ||
        tested == "CS" || tested == "IS" || tested == "LO" || tested == "LT" ||
        tested == "SH" || tested == "ST" || tested == "DS" || tested == "SL" ||
-       tested == "SS" || tested == "UL" || tested == "US" )
+       tested == "SS" || tested == "UL" || tested == "US" || tested == "UN")
    {
       return true;
    }