]> Creatis software - gdcm.git/blobdiff - src/gdcmPixelReadConvert.cxx
* Remove compilation warnings
[gdcm.git] / src / gdcmPixelReadConvert.cxx
index 3093f6abe0066b4cbeb6db749b9026e5684674a8..19317dbfac06611cf78495a6fc0e7955d99227d5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmPixelReadConvert.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/21 12:11:06 $
-  Version:   $Revision: 1.83 $
+  Date:      $Date: 2005/10/26 07:15:31 $
+  Version:   $Revision: 1.90 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -114,24 +114,48 @@ void PixelReadConvert::GrabInformationsFromFile( File *file )
    //PixelSize       = file->GetPixelSize();  Useless
    PixelSign       = file->IsSignedPixelData();
    SwapCode        = file->GetSwapCode();
-   std::string ts  = file->GetTransferSyntax();
-   IsRaw =
-        ( ! file->IsDicomV3() )
-     || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndian
-     || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRBigEndianPrivateGE
-     || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRLittleEndian
-     || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian
-     || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::DeflatedExplicitVRLittleEndian;
+   
+   if (! file->IsDicomV3() )  // Should be ACR-NEMA file
+   {
+      IsRaw = true;
+      // Don't loose time checking unexistant Transfer Syntax !
+      IsPrivateGETransferSyntax = IsMPEG
+             = IsJPEG2000 = IsJPEGLS = IsJPEGLossy  
+             = IsJPEGLossless = IsRLELossless 
+             = false;
+   }
+   else
+   {
+      std::string ts  = file->GetTransferSyntax();
+
+   
+//   if ( ts == GDCM_UNKNOWN )
+//   {
+//     gdcmErrorMacro( "Could someone tell me how in the world could this happen !" );
+// -->
+//--> on ALL acr-nema images ! JPRx
+//-->
+//     abort(); // DO NOT REMOVE.  WE SHOULD NEVER READ SUCH IMAGE EVER (only gdcm can write such broekn dicom file)
+//   }
+
+      IsRaw =
+           ( ! file->IsDicomV3() )  // Should be ACR-NEMA file
+        || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndian
+        || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRBigEndianPrivateGE
+        || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRLittleEndian
+        || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian
+        || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::DeflatedExplicitVRLittleEndian;
      
-   IsPrivateGETransferSyntax = 
+      IsPrivateGETransferSyntax = 
                 ( Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRBigEndianPrivateGE );
 
-   IsMPEG          = Global::GetTS()->IsMPEG(ts);
-   IsJPEG2000      = Global::GetTS()->IsJPEG2000(ts);
-   IsJPEGLS        = Global::GetTS()->IsJPEGLS(ts);
-   IsJPEGLossy     = Global::GetTS()->IsJPEGLossy(ts);
-   IsJPEGLossless  = Global::GetTS()->IsJPEGLossless(ts);
-   IsRLELossless   = Global::GetTS()->IsRLELossless(ts);
+      IsMPEG          = Global::GetTS()->IsMPEG(ts);
+      IsJPEG2000      = Global::GetTS()->IsJPEG2000(ts);
+      IsJPEGLS        = Global::GetTS()->IsJPEGLS(ts);
+      IsJPEGLossy     = Global::GetTS()->IsJPEGLossy(ts);
+      IsJPEGLossless  = Global::GetTS()->IsJPEGLossless(ts);
+      IsRLELossless   = Global::GetTS()->IsRLELossless(ts);
+   }
 
    PixelOffset     = file->GetPixelOffset();
    PixelDataLength = file->GetPixelAreaLength();
@@ -526,17 +550,19 @@ bool PixelReadConvert::ReadAndDecompressJPEGFile( std::ifstream *fp )
 }
 
 /**
- * \brief Build Red/Green/Blue/Alpha LUT from File
- *         when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
- *          and (0028,1101),(0028,1102),(0028,1102)
- *            - xxx Palette Color Lookup Table Descriptor - are found
- *          and (0028,1201),(0028,1202),(0028,1202)
- *            - xxx Palette Color Lookup Table Data - are found
+ * \brief Build Red/Green/Blue/Alpha LUT from File when :
+ *         - (0028,0004) : Photometric Interpretation == [PALETTE COLOR ]
+ *         and
+ *         - (0028,1101),(0028,1102),(0028,1102)
+ *            xxx Palette Color Lookup Table Descriptor are found
+ *          and 
+ *         - (0028,1201),(0028,1202),(0028,1202)
+ *           xxx Palette Color Lookup Table Data - are found
  * \warning does NOT deal with :
- *   0028 1100 Gray Lookup Table Descriptor (Retired)
- *   0028 1221 Segmented Red Palette Color Lookup Table Data
- *   0028 1222 Segmented Green Palette Color Lookup Table Data
- *   0028 1223 Segmented Blue Palette Color Lookup Table Data
+ *   0028 1100 Gray Lookup Table Descriptor (Retired)
+ *   0028 1221 Segmented Red Palette Color Lookup Table Data
+ *   0028 1222 Segmented Green Palette Color Lookup Table Data
+ *   0028 1223 Segmented Blue Palette Color Lookup Table Data
  *   no known Dicom reader deals with them :-(
  * @return a RGBA Lookup Table
  */
@@ -794,14 +820,10 @@ void PixelReadConvert::ConvertSwapZone()
    // Therefore, in either case, if the file is in
    // 'ImplicitVR BigEndian PrivateGE Transfer Syntax', then GDCM needs to switch
    // the byte swapping code when entering the pixel data.
-    
 
-// -->
-// --> Can't understand *why* TestWriteSimple fails sice this commit/
-// --> commented out, to be sure the troubles started from here.
-// --> JP
-/*   if ( IsPrivateGETransferSyntax )
+/* //Let me check something.
+   //I wait for the Dashboard !   
+   if ( IsPrivateGETransferSyntax )
    {
       // PrivateGETransferSyntax only exists for 'true' Dicom images
       // we assume there is no 'exotic' 32 bits endianess!
@@ -815,7 +837,7 @@ void PixelReadConvert::ConvertSwapZone()
             break;
       }  
    }
-*/
+*/   
    if ( BitsAllocated == 16 )
    {
       uint16_t *im16 = (uint16_t*)Raw;