]> Creatis software - gdcm.git/commitdiff
2004-01-31 Jean-Pierre Roux
authorjpr <jpr>
Mon, 2 Feb 2004 09:25:43 +0000 (09:25 +0000)
committerjpr <jpr>
Mon, 2 Feb 2004 09:25:43 +0000 (09:25 +0000)
     * FIX gdcmParser::WriteEntries : when a VR is tagged as 'Unknown'
                       no longer writes 'Un' on disk
     * FIX  SQ elements with actual length are now dealt with corectly
     * FIX gdcmFile::WriteBase make the difference, for color images, between
                     the length (for Palette expanded omages)
     and Raw Length (non expanded image + Palette)
      * FIX  Dicts/dicomV3.dic : removal of 'CTX' (context dependant) VR
                     (that broke Write). Replaced by UL.
     Aware user will reload the field if he
     thinks it's necesssary

ChangeLog
Dicts/dicomV3.dic
Dicts/dicomVR.dic
src/gdcmFile.cxx
src/gdcmFile.h
src/gdcmHeader.h
src/gdcmHeaderEntry.cxx
src/gdcmHeaderHelper.cxx
src/gdcmHeaderHelper.h
src/gdcmParser.cxx
src/gdcmParser.h

index 7dc245fecfc21f8f88bddb56838a0d199d62e10a..e853f6ed23a468dbb7e8238b18f0f3eab2808a5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,26 @@
+2004-01-31 Jean-Pierre Roux
+     * FIX gdcmParser::WriteEntries : when a VR is tagged as 'Unknown'
+                       no longer writes 'Un' on disk
+     * FIX  SQ elements with actual length are now dealt with corectly
+     * FIX gdcmFile::WriteBase make the difference, for color images, between
+                     the length (for Palette expanded omages) 
+                    and Raw Length (non expanded image + Palette)
+      * FIX  Dicts/dicomV3.dic : removal of 'CTX' (context dependant) VR
+                     (that broke Write). Replaced by UL.
+                    Aware user will reload the field if he 
+                    thinks it's necesssary
+                      
 2004-01-30 Jean-Pierre Roux
      * gdcmParser::CheckSwap() now defaults the filetype to ACR 
        when 'dirty Acr' is found, to be compliant with the new 
        IsReadable() methods.
+       
+     * gdcmHederlHelper :add Pixel Type 'FD', for dealing with 'double' images.
+      (no DOUBLE images in kosher DICOM, 
+      but so usefull for people that miss them ;-)
+      
+     * add Test/testDicomDir.cxx, Test/makeDicomDir.cxx , Test/explDICOMDIR.cxx
+       DICOMDIR related utilities (not checked as Windoze compliant)
 
 2004-01-28 Jean-Pierre Roux
      * upgrade GdcmHeaderEntry Print Method for DICOMDIR
index 25feb4f2c4865168b170578847f50a5577e789b2..7b03ae2215329ae02065e1db85f174cc6831f980 100644 (file)
 0028 3002 US IMG LUT Descriptor
 0028 3003 LO IMG LUT Explanation
 0028 3004 LO IMG Modality LUT Type
-0028 3006 CTX IMG LUT Data
+0028 3006 US IMG LUT Data (CTX dependent)
 0028 3010 SQ IMG VOI LUT Sequence
 0028 3110 SQ IMG Softcopy VOI LUT Sequence
 0028 4000 SH IMG Comments (RET)
 3008 0240 SQ ??? Fraction Status Summary Sequence
 3008 0250 DA ??? Treatment Date
 3008 0251 TM ??? Treatment Time
-300a 0000 UL RT  Group Length
-300a 0002 SH RT  RT Plan Label
-300a 0003 LO RT  RT Plan Name
-300a 0004 ST RT  RT Plan Description
-300a 0006 DA RT  RT Plan Date
-300a 0007 TM RT  RT Plan Time
-300a 0009 LO RT  Treatment Protocols
-300a 000a CS RT  Treatment Intent
-300a 000b LO RT  Treatment Sites
-300a 000c CS RT  RT Plan Geometry
-300a 000e ST RT  Prescription Description
-300a 0010 SQ RT  Dose Reference Sequence
-300a 0012 IS RT  Dose Reference Number
-300a 0014 CS RT  Dose Reference Structure Type
-300a 0015 CS RT  Nominal Beam Energy Unit
-300a 0016 LO RT  Dose Reference Description
-300a 0018 DS RT  Dose Reference Point Coordinates
-300a 001a DS RT  Nominal Prior Dose
-300a 0020 CS RT  Dose Reference Type
-300a 0021 DS RT  Constraint Weight
-300a 0022 DS RT  Delivery Warning Dose
-300a 0023 DS RT  Delivery Maximum Dose
-300a 0025 DS RT  Target Minimum Dose
-300a 0026 DS RT  Target Prescription Dose
-300a 0027 DS RT  Target Maximum Dose
-300a 0028 DS RT  Target Underdose Volume Fraction
-300a 002a DS RT  Organ at Risk Full-volume Dose
-300a 002b DS RT  Organ at Risk Limit Dose
-300a 002c DS RT  Organ at Risk Maximum Dose
-300a 002d DS RT  Organ at Risk Overdose Volume Fraction
-300a 0040 SQ RT  Tolerance Table Sequence
-300a 0042 IS RT  Tolerance Table Number
-300a 0043 SH RT  Tolerance Table Label
-300a 0044 DS RT  Gantry Angle Tolerance
-300a 0046 DS RT  Beam Limiting Device Angle Tolerance
-300a 0048 SQ RT  Beam Limiting Device Tolerance Sequence
-300a 004a DS RT  Beam Limiting Device Position Tolerance
-300a 004c DS RT  Patient Support Angle Tolerance
-300a 004e DS RT  Table Top Eccentric Angle Tolerance
-300a 0051 DS RT  Table Top Vertical Position Tolerance
-300a 0052 DS RT  Table Top Longitudinal Position Tolerance
-300a 0053 DS RT  Table Top Lateral Position Tolerance
-300a 0055 CS RT  RT Plan Relationship
-300a 0070 SQ RT  Fraction Group Sequence
-300a 0071 IS RT  Fraction Group Number
-300a 0078 IS RT  Number of Fractions Planned
-300a 0079 IS RT  Number of Fractions Per Day
-300a 007a IS RT  Repeat Fraction Cycle Length
-300a 007b LT RT  Fraction Pattern
-300a 0080 IS RT  Number of Beams
-300a 0082 DS RT  Beam Dose Specification Point
-300a 0084 DS RT  Beam Dose
-300a 0086 DS RT  Beam Meterset
-300a 00a0 IS RT  Number of Brachy Application Setups
-300a 00a2 DS RT  Brachy App Setup Dose Specification Point
-300a 00a4 DS RT  Brachy Application Setup Dose
-300a 00b0 SQ RT  Beam Sequence
-300a 00b2 SH RT  Treatment Machine Name
-300a 00b3 CS RT  Primary Dosimeter Unit
-300a 00b4 DS RT  Source-Axis Distance
-300a 00b6 SQ RT  Beam Limiting Device Sequence
-300a 00b8 CS RT  RT Beam Limiting Device Type
-300a 00ba DS RT  Source to Beam Limiting Device Distance
-300a 00bc IS RT  Number of Leaf/Jaw Pairs
-300a 00be DS RT  Leaf Position Boundaries
-300a 00c0 IS RT  Beam Number
-300a 00c2 LO RT  Beam Name
-300a 00c3 ST RT  Beam Description
-300a 00c4 CS RT  Beam Type
-300a 00c6 CS RT  Radiation Type
-300a 00c7 CS RT  High-Dose Technique Type
-300a 00c8 IS RT  Reference Image Number
-300a 00ca SQ RT  Planned Verification Image Sequence
-300a 00cc LO RT  Imaging Device-Specific Acquisition Parameters
-300a 00ce CS RT  Treatment Delivery Type
-300a 00d0 IS RT  Number of Wedges
-300a 00d1 SQ RT  Wedge Sequence
-300a 00d2 IS RT  Wedge Number
-300a 00d3 CS RT  Wedge Type
-300a 00d4 SH RT  Wedge ID
-300a 00d5 IS RT  Wedge Angle
-300a 00d6 DS RT  Wedge Factor
-300a 00d8 DS RT  Wedge Orientation
-300a 00da DS RT  Source to Wedge Tray Distance
-300a 00e0 IS RT  Number of Compensators
-300a 00e1 SH RT  Material ID
-300a 00e2 DS RT  Total Compensator Tray Factor
-300a 00e3 SQ RT  Compensator Sequence
-300a 00e4 IS RT  Compensator Number
-300a 00e5 SH RT  Compensator ID
-300a 00e6 DS RT  Source to Compensator Tray Distance
-300a 00e7 IS RT  Compensator Rows
-300a 00e8 IS RT  Compensator Columns
-300a 00e9 DS RT  Compensator Pixel Spacing
-300a 00ea DS RT  Compensator Position
-300a 00eb DS RT  Compensator Transmission Data
-300a 00ec DS RT  Compensator Thickness Data
-300a 00ed IS RT  Number of Boli
-300a 00f0 IS RT  Number of Blocks
-300a 00f2 DS RT  Total Block Tray Factor
-300a 00f4 SQ RT  Block Sequence
-300a 00f5 SH RT  Block Tray ID
-300a 00f6 DS RT  Source to Block Tray Distance
-300a 00f8 CS RT  Block Type
-300a 00fa CS RT  Block Divergence
-300a 00fb CS RT  Block Mounting Position
-300a 00fc IS RT  Block Number
-300a 00fe LO RT  Block Name
-300a 0100 DS RT  Block Thickness
-300a 0102 DS RT  Block Transmission
-300a 0104 IS RT  Block Number of Points
-300a 0106 DS RT  Block Data
-300a 0107 SQ RT  Applicator Sequence
-300a 0108 SH RT  Applicator ID
-300a 0109 CS RT  Applicator Type
-300a 010a LO RT  Applicator Description
-300a 010c DS RT  Cumulative Dose Reference Coefficient
-300a 010e DS RT  Final Cumulative Meterset Weight
-300a 0110 IS RT  Number of Control Points
-300a 0111 SQ RT  Control Point Sequence
-300a 0112 IS RT  Control Point Index
-300a 0114 DS RT  Nominal Beam Energy
-300a 0115 DS RT  Dose Rate Set
-300a 0116 SQ RT  Wedge Position Sequence
-300a 0118 CS RT  Wedge Position
-300a 011a SQ RT  Beam Limiting Device Position Sequence
-300a 011c DS RT  Leaf/Jaw Positions
-300a 011e DS RT  Gantry Angle
-300a 011f CS RT  Gantry Rotation Direction
-300a 0120 DS RT  Beam Limiting Device Angle
-300a 0121 CS RT  Beam Limiting Device Rotation Direction
-300a 0122 DS RT  Patient Support Angle
-300a 0123 CS RT  Patient Support Rotation Direction
-300a 0124 DS RT  Table Top Eccentric Axis Distance
-300a 0125 DS RT  Table Top Eccentric Angle
-300a 0126 CS RT  Table Top Eccentric Rotation Direction
-300a 0128 DS RT  Table Top Vertical Position
-300a 0129 DS RT  Table Top Longitudinal Position
-300a 012a DS RT  Table Top Lateral Position
-300a 012c DS RT  Isocenter Position
-300a 012e DS RT  Surface Entry Point
-300a 0130 DS RT  Source to Surface Distance
-300a 0134 DS RT  Cumulative Meterset Weight
-300a 0180 SQ RT  Patient Setup Sequence
-300a 0182 IS RT  Patient Setup Number
-300a 0184 LO RT  Patient Additional Position
-300a 0190 SQ RT  Fixation Device Sequence
-300a 0192 CS RT  Fixation Device Type
-300a 0194 SH RT  Fixation Device Label
-300a 0196 ST RT  Fixation Device Description
-300a 0198 SH RT  Fixation Device Position
-300a 01a0 SQ RT  Shielding Device Sequence
-300a 01a2 CS RT  Shielding Device Type
-300a 01a4 SH RT  Shielding Device Label
-300a 01a6 ST RT  Shielding Device Description
-300a 01a8 SH RT  Shielding Device Position
-300a 01b0 CS RT  Setup Technique
-300a 01b2 ST RT  Setup Technique Description
-300a 01b4 SQ RT  Setup Device Sequence
-300a 01b6 CS RT  Setup Device Type
-300a 01b8 SH RT  Setup Device Label
-300a 01ba ST RT  Setup Device Description
-300a 01bc DS RT  Setup Device Parameter
-300a 01d0 ST RT  Setup Reference Description
-300a 01d2 DS RT  Table Top Vertical Setup Displacement
-300a 01d4 DS RT  Table Top Longitudinal Setup Displacement
-300a 01d6 DS RT  Table Top Lateral Setup Displacement
-300a 0200 CS RT  Brachy Treatment Technique
-300a 0202 CS RT  Brachy Treatment Type
-300a 0206 SQ RT  Treatment Machine Sequence
-300a 0210 SQ RT  Source Sequence
-300a 0212 IS RT  Source Number
-300a 0214 CS RT  Source Type
-300a 0216 LO RT  Source Manufacturer
-300a 0218 DS RT  Active Source Diameter
-300a 021a DS RT  Active Source Length
-300a 0222 DS RT  Source Encapsulation Nominal Thickness
-300a 0224 DS RT  Source Encapsulation Nominal Transmission
-300a 0226 LO RT  Source Isotope Name
-300a 0228 DS RT  Source Isotope Half Life
-300a 022a DS RT  Reference Air Kerma Rate
-300a 022c DA RT  Air Kerma Rate Reference Date
-300a 022e TM RT  Air Kerma Rate Reference Time
-300a 0230 SQ RT  Application Setup Sequence
-300a 0232 CS RT  Application Setup Type
-300a 0234 IS RT  Application Setup Number
-300a 0236 LO RT  Application Setup Name
-300a 0238 LO RT  Application Setup Manufacturer
-300a 0240 IS RT  Template Number
-300a 0242 SH RT  Template Type
-300a 0244 LO RT  Template Name
-300a 0250 DS RT  Total Reference Air Kerma
-300a 0260 SQ RT  Brachy Acessory Device Sequence
-300a 0262 IS RT  Brachy Accessory Device Number
-300a 0263 SH RT  Brachy Accessory Device ID
-300a 0264 CS RT  Brachy Accessory Device Type
-300a 0266 LO RT  Brachy Accessory Device Name
-300a 026a DS RT  Brachy Accessory Device Nominal Thickness
-300a 026c DS RT  Brachy Accessory Device Nominal Transmission
-300a 0280 SQ RT  Channel Sequence
-300a 0282 IS RT  Channel Number
-300a 0284 DS RT  Channel Length
-300a 0286 DS RT  Channel Total Time
-300a 0288 CS RT  Source Movement Type
-300a 028a IS RT  Number of Pulses
-300a 028c DS RT  Pulse Repetition Interval
-300a 0290 IS RT  Source Applicator Number
-300a 0291 SH RT  Source Applicator ID
-300a 0292 CS RT  Source Applicator Type
-300a 0294 LO RT  Source Applicator Name
-300a 0296 DS RT  Source Applicator Length
-300a 0298 LO RT  Source Applicator Manufacturer
-300a 029c DS RT  Source Applicator Wall Nominal Thickness
-300a 029e DS RT  Source Applicator Wall Nominal Transmission
-300a 02a0 DS RT  Source Applicator Step Size
-300a 02a2 IS RT  Transfer Tube Number
-300a 02a4 DS RT  Transfer Tube Length
-300a 02b0 SQ RT  Channel Shield Sequence
-300a 02b2 IS RT  Channel Shield Number
-300a 02b3 SH RT  Channel Shield ID
-300a 02b4 LO RT  Channel Shield Name
-300a 02b8 DS RT  Channel Shield Nominal Thickness
-300a 02ba DS RT  Channel Shield Nominal Transmission
-300a 02c8 DS RT  Final Cumulative Time Weight
-300a 02d0 SQ RT  Brachy Control Point Sequence
-300a 02d2 DS RT  Control Point Relative Position
-300a 02d4 DS RT  Control Point 3D Position
-300a 02d6 DS RT  Cumulative Time Weight
-300a 02e0 CS RT  Compensator Divergence
-300a 02e1 CS RT  Compensator Mounting Position
-300a 02e2 DS RT  Source to Compensator Distance
-300c 0000 UL RT  Group Length
-300c 0002 SQ RT  Referenced RT Plan Sequence
-300c 0004 SQ RT  Referenced Beam Sequence
-300c 0006 IS RT  Referenced Beam Number
-300c 0007 IS RT  Referenced Reference Image Number
-300c 0008 DS RT  Start Cumulative Meterset Weight
-300c 0009 DS RT  End Cumulative Meterset Weight
-300c 000a SQ RT  Referenced Brachy Application Setup Sequence
-300c 000c IS RT  Referenced Brachy Application Setup Number
-300c 000e IS RT  Referenced Source Number
-300c 0020 SQ RT  Referenced Fraction Group Sequence
-300c 0022 IS RT  Referenced Fraction Group Number
-300c 0040 SQ RT  Referenced Verification Image Sequence
-300c 0042 SQ RT  Referenced Reference Image Sequence
-300c 0050 SQ RT  Referenced Dose Reference Sequence
-300c 0051 IS RT  Referenced Dose Reference Number
-300c 0055 SQ RT  Brachy Referenced Dose Reference Sequence
-300c 0060 SQ RT  Referenced Structure Set Sequence
-300c 006a IS RT  Referenced Patient Setup Number
-300c 0080 SQ RT  Referenced Dose Sequence
-300c 00a0 IS RT  Referenced Tolerance Table Number
-300c 00b0 SQ RT  Referenced Bolus Sequence
-300c 00c0 IS RT  Referenced Wedge Number
-300c 00d0 IS RT  Referenced Compensator Number
-300c 00e0 IS RT  Referenced Block Number
-300c 00f0 IS RT  Referenced Control Point Index
-300e 0000 UL RT  Group Length
-300e 0002 CS RT  Approval Status
-300e 0004 DA RT  Review Date
-300e 0005 TM RT  Review Time
-300e 0008 PN RT  Reviewer Name
+300a 0000 UL RT Group Length
+300a 0002 SH RT RT Plan Label
+300a 0003 LO RT RT Plan Name
+300a 0004 ST RT RT Plan Description
+300a 0006 DA RT RT Plan Date
+300a 0007 TM RT RT Plan Time
+300a 0009 LO RT Treatment Protocols
+300a 000a CS RT Treatment Intent
+300a 000b LO RT Treatment Sites
+300a 000c CS RT RT Plan Geometry
+300a 000e ST RT Prescription Description
+300a 0010 SQ RT Dose Reference Sequence
+300a 0012 IS RT Dose Reference Number
+300a 0014 CS RT Dose Reference Structure Type
+300a 0015 CS RT Nominal Beam Energy Unit
+300a 0016 LO RT Dose Reference Description
+300a 0018 DS RT Dose Reference Point Coordinates
+300a 001a DS RT Nominal Prior Dose
+300a 0020 CS RT Dose Reference Type
+300a 0021 DS RT Constraint Weight
+300a 0022 DS RT Delivery Warning Dose
+300a 0023 DS RT Delivery Maximum Dose
+300a 0025 DS RT Target Minimum Dose
+300a 0026 DS RT Target Prescription Dose
+300a 0027 DS RT Target Maximum Dose
+300a 0028 DS RT Target Underdose Volume Fraction
+300a 002a DS RT Organ at Risk Full-volume Dose
+300a 002b DS RT Organ at Risk Limit Dose
+300a 002c DS RT Organ at Risk Maximum Dose
+300a 002d DS RT Organ at Risk Overdose Volume Fraction
+300a 0040 SQ RT Tolerance Table Sequence
+300a 0042 IS RT Tolerance Table Number
+300a 0043 SH RT Tolerance Table Label
+300a 0044 DS RT Gantry Angle Tolerance
+300a 0046 DS RT Beam Limiting Device Angle Tolerance
+300a 0048 SQ RT Beam Limiting Device Tolerance Sequence
+300a 004a DS RT Beam Limiting Device Position Tolerance
+300a 004c DS RT Patient Support Angle Tolerance
+300a 004e DS RT Table Top Eccentric Angle Tolerance
+300a 0051 DS RT Table Top Vertical Position Tolerance
+300a 0052 DS RT Table Top Longitudinal Position Tolerance
+300a 0053 DS RT Table Top Lateral Position Tolerance
+300a 0055 CS RT RT Plan Relationship
+300a 0070 SQ RT Fraction Group Sequence
+300a 0071 IS RT Fraction Group Number
+300a 0078 IS RT Number of Fractions Planned
+300a 0079 IS RT Number of Fractions Per Day
+300a 007a IS RT Repeat Fraction Cycle Length
+300a 007b LT RT Fraction Pattern
+300a 0080 IS RT Number of Beams
+300a 0082 DS RT Beam Dose Specification Point
+300a 0084 DS RT Beam Dose
+300a 0086 DS RT Beam Meterset
+300a 00a0 IS RT Number of Brachy Application Setups
+300a 00a2 DS RT Brachy App Setup Dose Specification Point
+300a 00a4 DS RT Brachy Application Setup Dose
+300a 00b0 SQ RT Beam Sequence
+300a 00b2 SH RT Treatment Machine Name
+300a 00b3 CS RT Primary Dosimeter Unit
+300a 00b4 DS RT Source-Axis Distance
+300a 00b6 SQ RT Beam Limiting Device Sequence
+300a 00b8 CS RT RT Beam Limiting Device Type
+300a 00ba DS RT Source to Beam Limiting Device Distance
+300a 00bc IS RT Number of Leaf/Jaw Pairs
+300a 00be DS RT Leaf Position Boundaries
+300a 00c0 IS RT Beam Number
+300a 00c2 LO RT Beam Name
+300a 00c3 ST RT Beam Description
+300a 00c4 CS RT Beam Type
+300a 00c6 CS RT Radiation Type
+300a 00c7 CS RT High-Dose Technique Type
+300a 00c8 IS RT Reference Image Number
+300a 00ca SQ RT Planned Verification Image Sequence
+300a 00cc LO RT Imaging Device-Specific Acquisition Parameters
+300a 00ce CS RT Treatment Delivery Type
+300a 00d0 IS RT Number of Wedges
+300a 00d1 SQ RT Wedge Sequence
+300a 00d2 IS RT Wedge Number
+300a 00d3 CS RT Wedge Type
+300a 00d4 SH RT Wedge ID
+300a 00d5 IS RT Wedge Angle
+300a 00d6 DS RT Wedge Factor
+300a 00d8 DS RT Wedge Orientation
+300a 00da DS RT Source to Wedge Tray Distance
+300a 00e0 IS RT Number of Compensators
+300a 00e1 SH RT Material ID
+300a 00e2 DS RT Total Compensator Tray Factor
+300a 00e3 SQ RT Compensator Sequence
+300a 00e4 IS RT Compensator Number
+300a 00e5 SH RT Compensator ID
+300a 00e6 DS RT Source to Compensator Tray Distance
+300a 00e7 IS RT Compensator Rows
+300a 00e8 IS RT Compensator Columns
+300a 00e9 DS RT Compensator Pixel Spacing
+300a 00ea DS RT Compensator Position
+300a 00eb DS RT Compensator Transmission Data
+300a 00ec DS RT Compensator Thickness Data
+300a 00ed IS RT Number of Boli
+300a 00f0 IS RT Number of Blocks
+300a 00f2 DS RT Total Block Tray Factor
+300a 00f4 SQ RT Block Sequence
+300a 00f5 SH RT Block Tray ID
+300a 00f6 DS RT Source to Block Tray Distance
+300a 00f8 CS RT Block Type
+300a 00fa CS RT Block Divergence
+300a 00fb CS RT Block Mounting Position
+300a 00fc IS RT Block Number
+300a 00fe LO RT Block Name
+300a 0100 DS RT Block Thickness
+300a 0102 DS RT Block Transmission
+300a 0104 IS RT Block Number of Points
+300a 0106 DS RT Block Data
+300a 0107 SQ RT Applicator Sequence
+300a 0108 SH RT Applicator ID
+300a 0109 CS RT Applicator Type
+300a 010a LO RT Applicator Description
+300a 010c DS RT Cumulative Dose Reference Coefficient
+300a 010e DS RT Final Cumulative Meterset Weight
+300a 0110 IS RT Number of Control Points
+300a 0111 SQ RT Control Point Sequence
+300a 0112 IS RT Control Point Index
+300a 0114 DS RT Nominal Beam Energy
+300a 0115 DS RT Dose Rate Set
+300a 0116 SQ RT Wedge Position Sequence
+300a 0118 CS RT Wedge Position
+300a 011a SQ RT Beam Limiting Device Position Sequence
+300a 011c DS RT Leaf/Jaw Positions
+300a 011e DS RT Gantry Angle
+300a 011f CS RT Gantry Rotation Direction
+300a 0120 DS RT Beam Limiting Device Angle
+300a 0121 CS RT Beam Limiting Device Rotation Direction
+300a 0122 DS RT Patient Support Angle
+300a 0123 CS RT Patient Support Rotation Direction
+300a 0124 DS RT Table Top Eccentric Axis Distance
+300a 0125 DS RT Table Top Eccentric Angle
+300a 0126 CS RT Table Top Eccentric Rotation Direction
+300a 0128 DS RT Table Top Vertical Position
+300a 0129 DS RT Table Top Longitudinal Position
+300a 012a DS RT Table Top Lateral Position
+300a 012c DS RT Isocenter Position
+300a 012e DS RT Surface Entry Point
+300a 0130 DS RT Source to Surface Distance
+300a 0134 DS RT Cumulative Meterset Weight
+300a 0180 SQ RT Patient Setup Sequence
+300a 0182 IS RT Patient Setup Number
+300a 0184 LO RT Patient Additional Position
+300a 0190 SQ RT Fixation Device Sequence
+300a 0192 CS RT Fixation Device Type
+300a 0194 SH RT Fixation Device Label
+300a 0196 ST RT Fixation Device Description
+300a 0198 SH RT Fixation Device Position
+300a 01a0 SQ RT Shielding Device Sequence
+300a 01a2 CS RT Shielding Device Type
+300a 01a4 SH RT Shielding Device Label
+300a 01a6 ST RT Shielding Device Description
+300a 01a8 SH RT Shielding Device Position
+300a 01b0 CS RT Setup Technique
+300a 01b2 ST RT Setup Technique Description
+300a 01b4 SQ RT Setup Device Sequence
+300a 01b6 CS RT Setup Device Type
+300a 01b8 SH RT Setup Device Label
+300a 01ba ST RT Setup Device Description
+300a 01bc DS RT Setup Device Parameter
+300a 01d0 ST RT Setup Reference Description
+300a 01d2 DS RT Table Top Vertical Setup Displacement
+300a 01d4 DS RT Table Top Longitudinal Setup Displacement
+300a 01d6 DS RT Table Top Lateral Setup Displacement
+300a 0200 CS RT Brachy Treatment Technique
+300a 0202 CS RT Brachy Treatment Type
+300a 0206 SQ RT Treatment Machine Sequence
+300a 0210 SQ RT Source Sequence
+300a 0212 IS RT Source Number
+300a 0214 CS RT Source Type
+300a 0216 LO RT Source Manufacturer
+300a 0218 DS RT Active Source Diameter
+300a 021a DS RT Active Source Length
+300a 0222 DS RT Source Encapsulation Nominal Thickness
+300a 0224 DS RT Source Encapsulation Nominal Transmission
+300a 0226 LO RT Source Isotope Name
+300a 0228 DS RT Source Isotope Half Life
+300a 022a DS RT Reference Air Kerma Rate
+300a 022c DA RT Air Kerma Rate Reference Date
+300a 022e TM RT Air Kerma Rate Reference Time
+300a 0230 SQ RT Application Setup Sequence
+300a 0232 CS RT Application Setup Type
+300a 0234 IS RT Application Setup Number
+300a 0236 LO RT Application Setup Name
+300a 0238 LO RT Application Setup Manufacturer
+300a 0240 IS RT Template Number
+300a 0242 SH RT Template Type
+300a 0244 LO RT Template Name
+300a 0250 DS RT Total Reference Air Kerma
+300a 0260 SQ RT Brachy Acessory Device Sequence
+300a 0262 IS RT Brachy Accessory Device Number
+300a 0263 SH RT Brachy Accessory Device ID
+300a 0264 CS RT Brachy Accessory Device Type
+300a 0266 LO RT Brachy Accessory Device Name
+300a 026a DS RT Brachy Accessory Device Nominal Thickness
+300a 026c DS RT Brachy Accessory Device Nominal Transmission
+300a 0280 SQ RT Channel Sequence
+300a 0282 IS RT Channel Number
+300a 0284 DS RT Channel Length
+300a 0286 DS RT Channel Total Time
+300a 0288 CS RT Source Movement Type
+300a 028a IS RT Number of Pulses
+300a 028c DS RT Pulse Repetition Interval
+300a 0290 IS RT Source Applicator Number
+300a 0291 SH RT Source Applicator ID
+300a 0292 CS RT Source Applicator Type
+300a 0294 LO RT Source Applicator Name
+300a 0296 DS RT Source Applicator Length
+300a 0298 LO RT Source Applicator Manufacturer
+300a 029c DS RT Source Applicator Wall Nominal Thickness
+300a 029e DS RT Source Applicator Wall Nominal Transmission
+300a 02a0 DS RT Source Applicator Step Size
+300a 02a2 IS RT Transfer Tube Number
+300a 02a4 DS RT Transfer Tube Length
+300a 02b0 SQ RT Channel Shield Sequence
+300a 02b2 IS RT Channel Shield Number
+300a 02b3 SH RT Channel Shield ID
+300a 02b4 LO RT Channel Shield Name
+300a 02b8 DS RT Channel Shield Nominal Thickness
+300a 02ba DS RT Channel Shield Nominal Transmission
+300a 02c8 DS RT Final Cumulative Time Weight
+300a 02d0 SQ RT Brachy Control Point Sequence
+300a 02d2 DS RT Control Point Relative Position
+300a 02d4 DS RT Control Point 3D Position
+300a 02d6 DS RT Cumulative Time Weight
+300a 02e0 CS RT Compensator Divergence
+300a 02e1 CS RT Compensator Mounting Position
+300a 02e2 DS RT Source to Compensator Distance
+300c 0000 UL RT Group Length
+300c 0002 SQ RT Referenced RT Plan Sequence
+300c 0004 SQ RT Referenced Beam Sequence
+300c 0006 IS RT Referenced Beam Number
+300c 0007 IS RT Referenced Reference Image Number
+300c 0008 DS RT Start Cumulative Meterset Weight
+300c 0009 DS RT End Cumulative Meterset Weight
+300c 000a SQ RT Referenced Brachy Application Setup Sequence
+300c 000c IS RT Referenced Brachy Application Setup Number
+300c 000e IS RT Referenced Source Number
+300c 0020 SQ RT Referenced Fraction Group Sequence
+300c 0022 IS RT Referenced Fraction Group Number
+300c 0040 SQ RT Referenced Verification Image Sequence
+300c 0042 SQ RT Referenced Reference Image Sequence
+300c 0050 SQ RT Referenced Dose Reference Sequence
+300c 0051 IS RT Referenced Dose Reference Number
+300c 0055 SQ RT Brachy Referenced Dose Reference Sequence
+300c 0060 SQ RT Referenced Structure Set Sequence
+300c 006a IS RT Referenced Patient Setup Number
+300c 0080 SQ RT Referenced Dose Sequence
+300c 00a0 IS RT Referenced Tolerance Table Number
+300c 00b0 SQ RT Referenced Bolus Sequence
+300c 00c0 IS RT Referenced Wedge Number
+300c 00d0 IS RT Referenced Compensator Number
+300c 00e0 IS RT Referenced Block Number
+300c 00f0 IS RT Referenced Control Point Index
+300e 0000 UL RT Group Length
+300e 0002 CS RT Approval Status
+300e 0004 DA RT Review Date
+300e 0005 TM RT Review Time
+300e 0008 PN RT Reviewer Name
 4008 0000 UL RES Group Length
 4008 0040 SH RES Results ID
 4008 0042 LO RES Results ID Issuer
 6000 4000 LO OLY Comments (RET)
 7fe0 0000 UL PXL Group Length
 7fe0 0010 OB PXL Pixel Data
-fffa fffa SQ XX  Digital Signatures Sequence
-fffc fffc OB XX  Data Set Trailing Padding
-fffe e000 UL DL  Item
-fffe e00d UL DL  Item Delimitation Item
-fffe e0dd UL DL  Sequence Delimitation Item
+fffa fffa SQ XX Digital Signatures Sequence
+fffc fffc OB XX Data Set Trailing Padding
+fffe e000 UL DL Item
+fffe e00d UL DL Item Delimitation Item
+fffe e0dd UL DL Sequence Delimitation Item
 ffff ffff UKN UKN Unknown Code
index d31ec7d956ea826ba0448d22dfb3cbd49f589f20..6a1f2277aa2ddd2f4a3fd0afd7552dcb812a044e 100644 (file)
@@ -10,8 +10,8 @@ FD Floating Point Double; // 64-bit IEEE 754:1985 double
 IS Integer String;        // At most 12 bytes
 LO Long String;           // At most 64 chars
 LT Long Text;             // At most 10240 chars
-OB Other Byte String;     // String of bytes (vr independant)
-OW Other Word String;     // String of 16-bit words (vr dep)
+OB Other Byte String;     // String of bytes (VR independant)
+OW Other Word String;     // String of 16-bit words (VR dependant)
 PN Person Name;           // At most 64 chars
 SH Short String;          // At most 16 chars
 SL Signed Long;           // Exactly 4 bytes
index 6dfb630cf92002c072039c36509d3b5d9eb1fc8a..f1bb3770ba11b5abf3819e00d6340baa464c9310 100644 (file)
@@ -4,6 +4,8 @@
 #include "gdcmUtil.h"
 #include "jpeg/ljpg/jpegless.h"
 
+typedef std::pair<TagHeaderEntryHT::iterator,TagHeaderEntryHT::iterator> IterHT;
+
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
@@ -26,6 +28,7 @@
 gdcmFile::gdcmFile(gdcmHeader *header) {
    Header=header;
    SelfHeader=false;
+   PixelRead=-1; // no ImageData read yet.
 
    if (Header->IsReadable())
       SetPixelDataSizeFromHeader();
@@ -48,6 +51,7 @@ gdcmFile::gdcmFile(gdcmHeader *header) {
 gdcmFile::gdcmFile(std::string & filename) {
    Header=new gdcmHeader(filename.c_str());
    SelfHeader=true;
+   PixelRead=-1; // no ImageData read yet.
 
    if (Header->IsReadable())
       SetPixelDataSizeFromHeader();
@@ -56,6 +60,7 @@ gdcmFile::gdcmFile(std::string & filename) {
 gdcmFile::gdcmFile(const char * filename) {
    Header=new gdcmHeader(filename);
    SelfHeader=true;
+   PixelRead=-1; // no ImageData read yet.
 
    if (Header->IsReadable())
       SetPixelDataSizeFromHeader();
@@ -181,6 +186,7 @@ void * gdcmFile::GetImageData (void) {
    PixelData = (void *) malloc(lgrTotale);
    if (PixelData)
       GetImageDataIntoVector(PixelData, lgrTotale);
+   PixelRead=0; // no PixelRaw
    return(PixelData);
 }
 
@@ -207,7 +213,7 @@ void * gdcmFile::GetImageData (void) {
  */
 size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) {
    size_t l = GetImageDataIntoVectorRaw (destination, MaxSize);
-   
+   PixelRead=0 ; // no PixelRaw
    if (!Header->HasLUT())
       return lgrTotale; 
                             
@@ -275,6 +281,7 @@ void * gdcmFile::GetImageDataRaw (void) {
    PixelData = (void *) malloc(lgrTotale);
    if (PixelData)
       GetImageDataIntoVectorRaw(PixelData, lgrTotale);
+   PixelRead=1; // PixelRaw
    return(PixelData);
 }
 
@@ -306,6 +313,7 @@ size_t gdcmFile::GetImageDataIntoVectorRaw (void* destination, size_t MaxSize) {
 
    int nb, nbu, highBit, signe;
    std::string str_nbFrames, str_nb, str_nbu, str_highBit, str_signe;
+   PixelRead=1 ; // PixelRaw
  
    if ( lgrTotale > MaxSize ) {
       dbg.Verbose(0, "gdcmFile::GetImageDataIntoVector: pixel data bigger"
@@ -664,7 +672,36 @@ bool gdcmFile::WriteBase (std::string fileName, FileType type) {
          Header->SetEntryByNumber(rows   ,  0x0028, 0x0011);
    }   
    // ----------------- End of Special Patch ----------------
-
+   
+   // TODO : get the grPixel, numPixel values
+   guint16 grPixel =0x7fe0;
+   guint16 numPixel=0x0010;
+   
+   IterHT p;
+   TagKey key = gdcmDictEntry::TranslateToKey(grPixel, numPixel); 
+   gdcmHeaderEntry * a;
+   TagHeaderEntryHT::iterator p2;
+   
+  //IterHT it = GetHeaderEntrySameNumber(grPixel,numPixel);
+   // Update Pixel Data Length
+   // the *last* of the 7fe0,0010, if many.
+        
+/*    
+   // good looking, but it doesn't work
+   p= Header->GetEntry().equal_range(key); // get a pair of iterators first-last synonym
+   p2=p.second;               // iterator on the last synonym 
+   a=p2->second;              // H Table target column (2-nd col)
+   //a->SetLength(lgrTotale);
+   a->SetPrintLevel(2);
+   a->Print();
+   // use the old -wrong if many 7fe0,0010- way
+ */  
+   if (PixelRead==1)
+      Header->SetEntryLengthByNumber(lgrTotaleRaw,grPixel, numPixel);
+   else if (PixelRead==0)
+      Header->SetEntryLengthByNumber(lgrTotale,   grPixel, numPixel);
+   // if == -1 : no Pixel Data was read : abort the method 
+   
    Header->Write(fp1, type);
 
    // --------------------------------------------------------------
@@ -678,7 +715,7 @@ bool gdcmFile::WriteBase (std::string fileName, FileType type) {
          Header->SetEntryByNumber(columns, 0x0028, 0x0011);
    }   
    // ----------------- End of Special Patch ----------------
-
+   
    fwrite(PixelData, lgrTotale, 1, fp1);
    fclose (fp1);
    return(true);
index 92b02425e10fb55f44159cddfb1d3107ca3feeb4..d03f98e01e4377691b874266f6fbdcbf212aa04e 100644 (file)
@@ -96,6 +96,9 @@ private:
    size_t lgrTotaleRaw;  // Area length to receive the pixels
    size_t lgrTotale;     // Area length to receive the RGB pixels
                          // from Grey Plane + Palette Color
+   int PixelRead;     // ==1  if GetImageDataRaw was used
+                      // ==0  if GetImageData    was used
+                      // ==-1 if ImageData never read.
 
    int Parsed;               // weather already parsed
    std::string OrigFileName; // To avoid file overwrite
index 1e67bc4f84bd5d18596bd54861d9f73c5773752d..1e1e52091e0042f80161d2ee16fd355df793c24e 100644 (file)
@@ -97,6 +97,8 @@ public:
    inline virtual bool SetEntryByName(std::string content,std::string tagName)
       { return(gdcmParser::SetEntryByName(content,tagName)); }
 
+  inline virtual bool SetEntryLengthByNumber(guint32 l,guint16 group, guint16 element)
+      { return(gdcmParser::SetEntryLengthByNumber(l,group,element)); }
 
    inline virtual void UpdateShaEntries(void)
       { gdcmParser::UpdateShaEntries(); }
index 34424cc558af85db02f9a1b2353e856ef43c645f..514a591eace2439f0b913a6b01cc2771bc08f765 100644 (file)
@@ -14,7 +14,7 @@
 #include <iomanip> // for std::ios::left, ...
 
 
-#define MAX_SIZE_PRINT_ELEMENT_VALUE 64
+#define MAX_SIZE_PRINT_ELEMENT_VALUE 10000
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
@@ -51,7 +51,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    d2 = _CreateCleanString(v);  // replace non printable characters by '.'
    if (printLevel>=2) { 
       s << "lg : ";
-      lgth = GetReadLength();
+      lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
       if (lgth == 0xffffffff) {
          sprintf(st,"x(ffff)");  // I said : "x(ffff)" !
          s.setf(std::ios::left);
index 513f830f02647dd9aeed29fa85c0a4f517451b18..95128a194ba324ff094eb617e0f99cab032f41ed 100644 (file)
@@ -60,8 +60,8 @@
  * \ingroup gdcmHeaderHelper
  * \brief   cstor
  */
-gdcmHeaderHelper::gdcmHeaderHelper() : gdcmHeader( )
-{
+gdcmHeaderHelper::gdcmHeaderHelper() : gdcmHeader( ) {
+
 }
 
 /**
@@ -69,7 +69,13 @@ gdcmHeaderHelper::gdcmHeaderHelper() : gdcmHeader( )
  * \brief   cstor
  */
 gdcmHeaderHelper::gdcmHeaderHelper(const char *InFilename, 
-    bool exception_on_error) : gdcmHeader( InFilename , exception_on_error)
+                                   bool exception_on_error,
+                                   bool enable_sequences,
+                                  bool ignore_shadow)                             
+                 : gdcmHeader( InFilename, 
+                              exception_on_error,
+                               enable_sequences,
+                              ignore_shadow)
 {
 }
 
index f635c81b049e3719a627ce8908d4cf19d5242500..7a0b01cca12153e519dadfc8e7ce3996214ead0e 100644 (file)
@@ -66,7 +66,9 @@ class GDCM_EXPORT gdcmHeaderHelper : public gdcmHeader {
 public:
    gdcmHeaderHelper();
    gdcmHeaderHelper(const char *filename, 
-                    bool exception_on_error = false);
+              bool  exception_on_error = false, 
+              bool  enable_sequences   = false,
+             bool  ignore_shadow      = false);
 
    int GetPixelSize();
    std::string GetPixelType();
index 93f2f56f0767306992aa7bc80d43d65d98048278..a155c2936265f7acd1cd7aaa1d2ff91f753e096d 100644 (file)
@@ -104,8 +104,8 @@ gdcmParser::gdcmParser(const char *InFilename,
 
    if ( !OpenFile(exception_on_error))
       return;
-   Parse();
-   LoadHeaderEntries();
+   if (ParseHeader())
+     LoadHeaderEntries();
    CloseFile();
 
    wasUpdated = 0;  // will be set to 1 if user adds an entry
@@ -223,10 +223,8 @@ bool gdcmParser::SetShaDict(DictKey dictName){
  *         false otherwise. 
  */
 bool gdcmParser::IsReadable(void) { 
-cout << "filetype [" << filetype <<"]" << endl;
    if(filetype==Unknown)
       return(false);
-cout << "trouv filetype" << endl;
    if(listEntries.size()<=0)
       return(false);
 
@@ -996,6 +994,8 @@ void gdcmParser::UpdateGroupLength(bool SkipSequence, FileType type) {
  * \ warning does NOT add the missing elements in the header :
  * \         it's up to the user doing it !
  * \         (function CheckHeaderCoherence to be written)
+ * \ warning DON'T try, right now, to write a DICOM image
+ * \         from an ACR Header (meta elements will be missing!)
  * @param   type type of the File to be written 
  *          (ACR-NEMA, ExplicitVR, ImplicitVR)
  * @param   _fp already open file pointer
@@ -1008,9 +1008,11 @@ void gdcmParser::WriteEntries(FileType type, FILE * _fp)
    std::string vr;
    guint32 val_uint32;
    guint16 val_uint16;
-   
+   guint16 valZero =0;
    std::vector<std::string> tokens;
    
+   // TODO : function CheckHeaderCoherence to be written
+   
    //  uses now listEntries to iterate, not TagHt!
    //
    //        pb : gdcmParser.Add does NOT update listEntries
@@ -1018,6 +1020,12 @@ void gdcmParser::WriteEntries(FileType type, FILE * _fp)
 
    void *ptr;
 
+   // TODO : get grPixel and numPixel
+   guint16 grPixel =0x7fe0;
+   guint16 numPixel=0x0010;
+   //IterHT it = GetHeaderEntrySameNumber(grPixel,numPixel);
+   
+
    // TODO (?) tester les echecs en ecriture (apres chaque fwrite)
 
    for (ListTag::iterator tag2=listEntries.begin();
@@ -1026,11 +1034,10 @@ void gdcmParser::WriteEntries(FileType type, FILE * _fp)
    {
       gr =  (*tag2)->GetGroup();
       el =  (*tag2)->GetElement();
-      lgr = (*tag2)->GetLength();
+      lgr = (*tag2)->GetReadLength();
       val = (*tag2)->GetValue().c_str();
       vr =  (*tag2)->GetVR();
-//cout << hex << gr << " " << el << " "<< vr << " " << val << endl; // JPR
-      
+ cout << hex << gr << " " << el << "  " << vr <<" lgr " << lgr << endl;     
       if ( type == ACR ) 
       { 
          if (gr < 0x0008)   continue; // ignore pure DICOM V3 groups
@@ -1052,21 +1059,30 @@ void gdcmParser::WriteEntries(FileType type, FILE * _fp)
       {
          // EXPLICIT VR
          guint16 z=0, shortLgr;
-         if (gr != 0xfffe) // JPR       
-            fwrite (vr.c_str(),(size_t)2 ,(size_t)1 ,_fp);
-
-         if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || gr == 0xfffe) // JPR
-         {
-            if (gr != 0xfffe)
-              fwrite ( &z,  (size_t)2 ,(size_t)1 ,_fp);
-            fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
-
-         } 
-         else 
-         {
+        if (vr == "Unknown") { // Unknown was 'written'         
             shortLgr=lgr;
             fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
-         }
+            fwrite ( &z,  (size_t)2 ,(size_t)1 ,_fp);
+        } else {        
+            if (gr != 0xfffe) { // NO value for 'delimiters'
+             if (vr == "Unknown") // Unknown was 'written'
+                fwrite(&z,(size_t)2 ,(size_t)1 ,_fp);
+             else       
+                 fwrite (vr.c_str(),(size_t)2 ,(size_t)1 ,_fp);
+            }
+        
+            if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || gr == 0xfffe) // JPR
+            {
+               if (gr != 0xfffe)
+                 fwrite ( &z,  (size_t)2 ,(size_t)1 ,_fp);
+               fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
+            } 
+            else 
+            {
+               shortLgr=lgr;
+               fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
+            }
+        }
       } 
       else // IMPLICIT VR 
       { 
@@ -1105,7 +1121,10 @@ void gdcmParser::WriteEntries(FileType type, FILE * _fp)
          continue;
       }     
       // Pixels are never loaded in the element !
-      if ((gr == 0x7fe0) && (el == 0x0010) ) 
+      
+      // TODO : FIX --> doesn't work when ICONE is found !!!
+      
+      if ((gr == grPixel) && (el == numPixel) ) 
          break;
 
       fwrite ( val,(size_t)lgr ,(size_t)1 ,_fp); // Elem value
@@ -1176,18 +1195,22 @@ guint16 gdcmParser::UnswapShort(guint16 a) {
 /**
  * \ingroup gdcmParser
  * \brief   Parses the header of the file but WITHOUT loading element values.
+ * @return  false if file is not ACR-NEMA / DICOM
  */
-void gdcmParser::Parse(bool exception_on_error) throw(gdcmFormatError) {
-   gdcmHeaderEntry *newHeaderEntry = (gdcmHeaderEntry *)0;
+bool gdcmParser::ParseHeader(bool exception_on_error) throw(gdcmFormatError) {
    
    rewind(fp);
-   CheckSwap();
+   if (!CheckSwap())
+      return false;
+      
+   gdcmHeaderEntry *newHeaderEntry = (gdcmHeaderEntry *)0;   
    while ( (newHeaderEntry = ReadNextHeaderEntry()) ) {
      SkipHeaderEntry(newHeaderEntry);
-     if ( (ignoreShadow==0) || (newHeaderEntry->GetGroup()%2) == 0) { //JPR
+     if ( (ignoreShadow==0) || (newHeaderEntry->GetGroup()%2) == 0) { 
         AddHeaderEntry(newHeaderEntry); 
      }      
    }
+   return true;
 }
 
 /**
@@ -1241,9 +1264,8 @@ void gdcmParser::LoadHeaderEntries(void) {
 
 /**
  * \ingroup       gdcmParser
- * \brief         Loads the element content if it's length is not bigger
- *                than the value specified with
- *                gdcmParser::SetMaxSizeLoadEntry()
+ * \brief         Loads the element content if its length doesn't exceed
+ *                the value specified with gdcmParser::SetMaxSizeLoadEntry()
  * @param         Entry Header Entry (Dicom Element) to be dealt with
  */
 void gdcmParser::LoadHeaderEntry(gdcmHeaderEntry *Entry)  {
@@ -1295,7 +1317,7 @@ void gdcmParser::LoadHeaderEntry(gdcmHeaderEntry *Entry)  {
    
    // When integer(s) are expected, read and convert the following 
    // n *(two or four bytes)
-   // properly i.e. as integers as opposed to a strings.       
+   // properly i.e. as integers as opposed to strings. 
    // Elements with Value Multiplicity > 1
    // contain a set of integers (not a single one) 
        
@@ -1346,7 +1368,7 @@ void gdcmParser::LoadHeaderEntry(gdcmHeaderEntry *Entry)  {
    }
 
    if( (vr == "UI") ) // Because of correspondance with the VR dic
-      Entry->SetValue(NewValue.c_str());
+      Entry->SetValue(NewValue.c_str()); // ??? JPR ???
    else
       Entry->SetValue(NewValue);
 }
@@ -1356,7 +1378,7 @@ void gdcmParser::LoadHeaderEntry(gdcmHeaderEntry *Entry)  {
  * \brief   add a new Dicom Element pointer to 
  *          the H Table and to the chained List
  * \warning push_bash in listEntries ONLY during ParseHeader
- * \todo    something to allow further Elements addition,
+ * \TODO    something to allow further Elements addition,
  * \        when position to be taken care of     
  * @param   newHeaderEntry
  */
@@ -1941,19 +1963,23 @@ void gdcmParser::Initialise(void)
  * \ingroup gdcmParser
  * \brief   Discover what the swap code is (among little endian, big endian,
  *          bad little endian, bad big endian).
- *
+ *          sw is set
+ * @return false when we are absolutely sure 
+ *               it's neither ACR-NEMA nor DICOM
+ *         true  when we hope ours assuptions are OK
  */
-void gdcmParser::CheckSwap() {
+bool gdcmParser::CheckSwap() {
 
    // The only guaranted way of finding the swap code is to find a
    // group tag since we know it's length has to be of four bytes i.e.
    // 0x00000004. Finding the swap code in then straigthforward. Trouble
    // occurs when we can't find such group...
    
-   guint32  s;
    guint32  x=4;  // x : for ntohs
    bool net2host; // true when HostByteOrder is the same as NetworkByteOrder
-    
+   guint32  s32;
+   guint16  s16;
+       
    int lgrLue;
    char *entCur;
    char deb[HEADER_LENGTH_TO_READ];
@@ -2023,7 +2049,7 @@ void gdcmParser::CheckSwap() {
       // after the file preamble and the "DICM" string).
       rewind(fp);
       fseek (fp, 132L, SEEK_SET);
-      return;
+      return true;
    } // End of DicomV3
 
    // Alas, this is not a DicomV3 file and whatever happens there is no file
@@ -2041,40 +2067,70 @@ void gdcmParser::CheckSwap() {
    // We assume the array of char we are considering contains the binary
    // representation of a 32 bits integer. Hence the following dirty
    // trick :
-   s = *((guint32 *)(entCur));
+   s32 = *((guint32 *)(entCur));
       
-   switch (s) {
+   switch (s32) {
       case 0x00040000 :
          sw = 3412;
          filetype = ACR;
-         return;
+         return true;
       case 0x04000000 :
          sw = 4321;
          filetype = ACR;
-         return;
+         return true;
       case 0x00000400 :
          sw = 2143;
          filetype = ACR;
-         return;
+         return true;
       case 0x00000004 :
          sw = 0;
          filetype = ACR;
-         return;
+         return true;
       default :
-         dbg.Verbose(0, "gdcmParser::CheckSwap:",
-                     "ACR/NEMA unfound swap info (time to raise bets)");
         
       // We are out of luck. It is not a DicomV3 nor a 'clean' ACR/NEMA file.
       // It is time for despaired wild guesses. 
-      // So, let's assume this file happens to be 'dirty' ACR/NEMA,
-      //  i.e. the length of the group is  not present.     
+      // So, let's check if this file wouldn't happen to be 'dirty' ACR/NEMA,
+      //  i.e. the 'group length' element is not present :     
+      
+      //  check the supposed to be 'group number'
+      //  0x0002 or 0x0004 or 0x0008
+      //  to determine ' sw' value .
+      //  Only 0 or 4321 will be possible 
+      //  (no oportunity to check for the formerly well known
+      //  ACR-NEMA 'Bad Big Endian' or 'Bad Little Endian' 
+      //  if unsuccessfull (i.e. neither 0x0002 nor 0x0200 etc -4, 8-) 
+      //  the file IS NOT ACR-NEMA nor DICOM V3
+      //  Find a trick to tell it the caller...
+      
+      s16 = *((guint16 *)(deb));
+      
+      switch (s16) {
+      case 0x0002 :
+      case 0x0004 :
+      case 0x0008 :      
+         sw = 0;
          filetype = ACR;
-      // Then the only info we have is the net2host one.    
-        if (! net2host )
-            sw = 0;
-         else
+         return true;
+      case 0x0200 :
+      case 0x0400 :
+      case 0x0800 : 
          sw = 4321;
-         return;                       
+         filetype = ACR;
+        return true;
+      default :
+         dbg.Verbose(0, "gdcmParser::CheckSwap:",
+                     "ACR/NEMA unfound swap info (Really hopeless !)"); 
+         filetype = Unknown;     
+         return false;
+      }
+        
+      // Then the only info we have is the net2host one.        
+        //if (! net2host )
+         //   sw = 0;
+         //else
+         //  sw = 4321;
+         //return;                             
    }
 }
 
@@ -2312,6 +2368,7 @@ gdcmHeaderEntry *gdcmParser::NewHeaderEntryByNumber(guint16 Group, guint16 Elem)
    return NewEntry;
 }
 
+// Never used; commented out, waiting for removal.
 /**
  * \ingroup gdcmParser
  * \brief   Small utility function that creates a new manually crafted
@@ -2322,28 +2379,28 @@ gdcmHeaderEntry *gdcmParser::NewHeaderEntryByNumber(guint16 Group, guint16 Elem)
  * @param   VR The Value Representation to be given to this new tag.
  * @return  The newly hand crafted Element Value.
  */
-gdcmHeaderEntry *gdcmParser::NewManualHeaderEntryToPubDict(std::string NewTagName, 
-                                                           std::string VR) 
-{
-   gdcmHeaderEntry *NewEntry = NULL;
-   guint32 StuffGroup = 0xffff;   // Group to be stuffed with additional info
-   guint32 FreeElem = 0;
-   gdcmDictEntry *DictEntry = NULL;
-
-   FreeElem = GenerateFreeTagKeyInGroup(StuffGroup);
-   if (FreeElem == UINT32_MAX) 
-   {
-      dbg.Verbose(1, "gdcmHeader::NewManualHeaderEntryToPubDict",
-                     "Group 0xffff in Public Dict is full");
-      return NULL;
-   }
-
-   DictEntry = NewVirtualDictEntry(StuffGroup, FreeElem,
-                                VR, "GDCM", NewTagName);
-   NewEntry = new gdcmHeaderEntry(DictEntry);
-   AddHeaderEntry(NewEntry);
-   return NewEntry;
-}
+//gdcmHeaderEntry *gdcmParser::NewManualHeaderEntryToPubDict(std::string NewTagName, 
+//                                                           std::string VR) 
+//{
+//   gdcmHeaderEntry *NewEntry = NULL;
+//   guint32 StuffGroup = 0xffff;   // Group to be stuffed with additional info
+//   guint32 FreeElem = 0;
+//   gdcmDictEntry *DictEntry = NULL;
+//
+//   FreeElem = GenerateFreeTagKeyInGroup(StuffGroup);
+//   if (FreeElem == UINT32_MAX) 
+//   {
+//      dbg.Verbose(1, "gdcmHeader::NewManualHeaderEntryToPubDict",
+//                     "Group 0xffff in Public Dict is full");
+//      return NULL;
+//   }
+//
+//   DictEntry = NewVirtualDictEntry(StuffGroup, FreeElem,
+//                                VR, "GDCM", NewTagName);
+//   NewEntry = new gdcmHeaderEntry(DictEntry);
+//   AddHeaderEntry(NewEntry);
+//   return NewEntry;
+//}
 
 /**
  * \ingroup gdcmParser
index 65bbdc714cb5a481e8aa88d814dcbc7a9e020c90..74db3d233c6fd53d53f5360a01ef42217fbdb442 100644 (file)
@@ -150,7 +150,7 @@ protected:
    
 private:
    // Read
-   void Parse(bool exception_on_error = false) throw(gdcmFormatError);
+   bool ParseHeader(bool exception_on_error = false) throw(gdcmFormatError);
 
    void LoadHeaderEntries    (void);
    void LoadHeaderEntry      (gdcmHeaderEntry *);
@@ -173,7 +173,7 @@ private:
    void    SkipBytes(guint32);
 
    void Initialise(void);
-   void CheckSwap(void);
+   bool CheckSwap(void);
    void SwitchSwapToBigEndian(void);
    void SetMaxSizeLoadEntry(long);
    void SetMaxSizePrintEntry(long);
@@ -195,9 +195,9 @@ private:
    gdcmHeaderEntry *NewHeaderEntryByName  (std::string Name);
 
 
-   // Deprecated (Not used)
-   gdcmHeaderEntry *NewManualHeaderEntryToPubDict(std::string NewTagName,
-                                                  std::string VR);
+   // Deprecated (Not used) --> commented out
+   //gdcmHeaderEntry *NewManualHeaderEntryToPubDict(std::string NewTagName,
+   //                                               std::string VR);
    guint32 GenerateFreeTagKeyInGroup(guint16 group);
 
    // Refering underlying filename.