mrdicom__define.pro


Name:
mrdicom
Methods:
Constructors and destructor
mrdicom::init               : the constructor part II
mrdicom_setUIDs             : must be called once before instanciating the first object

Public variables (get)
mrdicom::img                : return pointer to image data
mrdicom::errno              : returns error number of last write (0 if ok)
mrdicom::errMsg             : returns error message of last read or write ('' if ok)
mrdicom::filename           : returns the full filename associated with this object

Public functions and procedures
mrdicom::setImg             : set image data to be written
mrdicom::getTagValue        : get the value of a dicom header field by name
mrdicom::setTagValue        : set the value of a dicom header field
mrdicom::anonymize          : anonymize patient related data in the header
mrdicom::copy               : copy all dicom info (except image data) from some other object
mrdicom::write              : write the new dicom file to disc
mrdicom::generateUID        : generate unique ids for the new header

Private
mrdicom::fillCache          : fill the local structure from the dicom header
mrdicom::setBasicTags       : sets some std dicom tags - used by the constructor
mrdicom::getbytes           : private function for big/little endian handling
mrdicom::setVRtag           : sets data type for a certain header data element
mrdicom::generate_pixeltag  : private function, used when writing data
mrdicom::generate_anytag    : private function, used when writing data
mrdicom__define             : the constructor
mrdicom::cleanup            : the destructor
Description:
An object extending IDLffDicom to provide
- writing of dicom files
- direct access to user data

Unique identifiers
Please see the documentation of mrdicom_setUIDs for a list of all UIDs and how to
set and use them.

Restrictions:
mrdicom only supports dicom default transfer syntax which is
Dicom implicit VR little endian, UID = 1.2.840.1008.1.2
 
There's no support for multi-valued tags (like e.g. ACQ aquisition matrix)
 
Concerning getTagValue/setTagValue:
As of now mrdicom does not support sequences (and probably never will).
All data stored in sequences is silently ignored - if you need it, you
will have to access the data directly via getValue(group/element) and
select the ones with parent != -1.
 
A word on Dicom data types:
Data elemens (DE) of type 1 are mandatory and must be present with a valid value,
DEs of type 2 must be present, but the value may be empty.
DEs of type 1C and 2C are mandatory in the above sense under certain conditions.
mrDicom does not know about such conditions and thus cannot check them. DEs of
types 1C and 2C are not written, if their value is empty - it is therefore the user's
responsibility to provide a value, if the conditions require the DE to be present.
 
According to my printout of the DICOM3.0 standard, the VR type 'DS' is limited
to 16 bytes. However the latest Siemens software writes (at least for tag x20,x37)
more than 100 bytes. Since no other software seems to complain, we set no limit
on the size of elements of VR type 'DS'.
That's the nice thing about standards - there's so many ways of interpreting them.
 
For lack of complete documentation (and time) only the MR-relevant DICOM
tags are covered. Here's the full list (also see mrdicom::setTagValue).
The two tags marked 'U' are not implemented and only listed for completeness.
With the standard at hand, it should be easy to add tags as needed.

GROUP  ELEMENT TYPE   DESCRIPTION                  FORMAT    INTERNAL VARIABLE
================================================================================
0002x  0000x  META Group Length                      UL  m_GroupLength
0002x  0001x  META File Meta Information Version     OB  m_FileMetaInfoVersion
0002x  0002x  META Media Stored SOP Class UID        UI  m_MediaStoredSOPClassUID
0002x  0003x  META Media Stored SOP Instance UID     UI  m_MediaStoredSOPInstanceUID
0002x  0010x  META Transfer Syntax UID               UI  m_TransferSyntaxUID
0002x  0012x  META Implementation Class UID          UI  m_ImplementationClassUID
0002x  0013x  META Implementation Version Name       SH  m_ImplementationVersionName
0002x  0016x  META Source application entity title   AE  m_SourceApplicationEntityTitle
0008x  0005x  ID Specific Character Set              CS  i_CharacterSet
0008x  0008x  ID Image Type                          CS  i_ImageType
0008x  0016x  ID SOP Class UID                       UI  i_SOPClassUID
0008x  0018x  ID SOP Instance UID                    UI  i_SOPInstanceUID
0008x  0020x  ID Study Date                          DA  i_StudyDate
0008x  0021x  ID Series Date                         DA  i_SeriesDate
0008x  0022x  ID Acquisition Date                    DA  i_AcquisitionDate
0008x  0023x  ID Image Date                          DA  i_ImageDate
0008x  0030x  ID Study Time                          TM  i_StudyTime
0008x  0031x  ID Series Time                         TM  i_SeriesTime
0008x  0032x  ID Acquisition Time                    TM  i_AcquisitionTime
0008x  0033x  ID Image Time                          TM  i_ImageTime
0008x  0050x  ID Accession Number                    SH  i_AccessionNumber
0008x  0060x  ID Modality                            CS  i_Modality
0008x  0070x  ID Manufacturer                        LO  i_Manufacturer
0008x  0080x  ID Institution Name                    LO  i_InstitutionName
0008x  0081x  ID Institution Address                 ST  i_InstitutionAddress
0008x  0090x  ID Referring Physician's Name          LO  i_PhysiciansName
0008x  1010x  ID Station Name                        SH  i_StationName
0008x  1030x  ID Study Description                   LO  i_StudyDescription
0008x  103Ex  ID Series Description                  LO  i_SeriesDescription
0008x  1070x  ID Operator's Name                     PN  i_OperatorsName
0008x  1090x  ID Manufacturer Model Name             LO  i_ManufacturerModelName
U  0008x  1111x  ID Referenced Study Component Sequence SQ  i_RefStudyComponentSequence
0008x  1150x  ID Referenced SOP Class UID            UI  i_RefSOPClassUID
0008x  1155x  ID Referenced SOP Instance UID         UI  i_RefSOPInstanceUID
U  0008x  1140x  ID Referenced Image Sequence           SQ  i_RefImageSequence
0010x  0010x  PAT Patient Name                       LO  p_PatientName
0010x  0020x  PAT Patient ID                         LO  p_PatientId
0010x  0030x  PAT Patient Birthdate                  DA  p_PatientBirthdate
0010x  0040x  PAT Patient Sex                        CS  p_PatientSex
0010x  1010x  PAT Patient Age                        AS  p_PatientAge
0010x  1030x  PAT Patient Weight                     DS  p_PatientWeight
0010x  2000x  PAT Medical Alerts                     LO  p_PatientAlerts
0010x  21C0x  PAT Pregnancy Status                   US  p_PregnancyStatus
0010x  4000x  PAT Patient Comments                   LO  p_PatientComments
0018x  0010x  ACQ Contrast/Bolus Agent               LO  a_ContrastBolusAgent
0018x  0015x  ACQ Body Part Examined                 CS  a_BodyPartExamined
0018x  0020x  ACQ Scanning Sequence                  CS  a_ScanningSequence
0018x  0021x  ACQ Sequence Variant                   CS  a_SequenceVariant
0018x  0022x  ACQ Scan Options                       CS  a_ScanOptions
0018x  0023x  ACQ MR Acquisition Type                CS  a_AcquisitionType
0018x  0024x  ACQ Sequence Name                      SH  a_SequenceName
0018x  0025x  ACQ Angio Flag                         CS  a_AngioFlag
0018x  0050x  ACQ Slice Thickness                    DS  a_SliceThickness
0018x  0080x  ACQ Repetition Time                    DS  a_RepetitionTime
0018x  0081x  ACQ Echo Time                          DS  a_EchoTime
0018x  0082x  ACQ Inversion Time                     DS  a_InversionTime
0018x  0083x  ACQ Number of Averages                 DS  a_NumberOfAverages
0018x  0084x  ACQ Imaging Frequency                  DS  a_ImagingFrequency
0018x  0085x  ACQ Imaged Nucleus                     SH  a_ImagedNucleus
0018x  0086x  ACQ Echo Number                        IS  a_EchoNumber
0018x  0087x  ACQ Magnetic Field Strength            DS  a_MagneticFieldStrength
0018x  0088x  ACQ Spacing Between Slices             DS  a_SpacingBetweenSlices
0018x  0089x  ACQ Number of Phase Encoding Steps     IS  a_NumberOfPhaseEncodingSteps
0018x  0091x  ACQ Echo Train Length                  IS  a_EchoTrainLength
0018x  0093x  ACQ Percent Sampling                   DS  a_PercentSampling
0018x  0094x  ACQ Percent Phase Field of View        DS  a_PercentPhaseFieldOfView
0018x  0095x  ACQ Pixel Bandwidth                    DS  a_PixelBandwidth
0018x  1000x  ACQ Device Serial Number               LO  a_DeviceSerialNumber
0018x  1020x  ACQ Software Version                   LO  a_SoftwareVersion
0018x  1030x  ACQ Protocol Name                      LO  a_ProtocolName
0018x  1041x  ACQ Contrast/Bolus Volume              DS  a_ContrastBolusVolume
0018x  1200x  ACQ Date of Last Calibration           DA  a_DateOfLastCalibration
0018x  1201x  ACQ Time of Last Calibration           TM  a_TimeOfLastCalibration
0018x  1250x  ACQ Receiving Coil                     SH  a_ReceivingCoil
0018x  1251x  ACQ Transmitting Coil                  SH  a_TransmittingCoil
0018x  1312x  ACQ Phase Encoding Direction           CS  a_PhaseEncodingDirection
0018x  1314x  ACQ Flip Angle                         DS  a_FlipAngle
0018x  1315x  ACQ Variable Flip Angle                CS  a_VariableFlipAngle
0018x  1316x  ACQ SAR                                DS  a_SAR
0018x  1318x  ACQ DB/DT                              DS  a_DBDT
0018x  5100x  ACQ Patient Position                   CS  a_PatientPosition
0020x  000Dx  REL Study Instance UID                 UI  r_StudyInstanceUID
0020x  000Ex  REL Series Instance UID                UI  r_SeriesInstanceUID
0020x  0010x  REL Study ID                           SH  r_StudyID
0020x  0011x  REL Series Number                      IS  r_SeriesNumber
0020x  0012x  REL Acquisition Number                 IS  r_AcquisitionNumber
0020x  0013x  REL Image Number                       IS  r_ImageNumber
0020x  0030x  REL Image Position                     RT  r_ImagePosition
0020x  0032x  REL Image Position Patient             DS  r_ImagePositionPatient
0020x  0035x  REL Image Orientation                  RT  r_ImageOrientation
0020x  0037x  REL Image Orientation (Patient)        DS  r_ImageOrientPatient
0020x  0050x  REL Location (RET)                     RT  r_Location
0020x  0052x  REL Frame of Reference UID             UI  r_FrameOfReference
0020x  0070x  REL Image Geometry Type (RET)          RT  r_ImageGeometryType
0020x  0080x  REL Masking Image (RET)                RT  r_MaskingImage
0020x  1001x  REL Acquisitions in Series             RT  r_AcqusitionInSeries
0020x  1040x  REL Position Reference Indicator       LO  r_PositionReferenceIndicator
0020x  1041x  REL Slice Location                     DS  r_SliceLocation
0020x  4000x  REL Image Comments                     LT  r_ImageComments
0028x  0002x  IMG Samples Per Pixel                  US  g_SamplesPerPixel
0028x  0004x  IMG Photometric Interpretation         CS  g_PhotometricInterpretation
0028x  0005x  IMG Image Dimensions (RET)             RT  g_ImageDimension
0029x  0006x  IMG Planar Configuration               US  g_PlanarConfiguration
0028x  0010x  IMG Rows                               US  g_Rows
0028x  0011x  IMG Columns                            US  g_Columns
0028x  0030x  IMG Pixel Spacing                      DS  g_PixelSpacing
0028x  0040x  IMG Image Format (RET)                 RT  g_ImageFormat
0028x  0100x  IMG Bits Allocated                     US  g_BitsAllocated
0028x  0101x  IMG Bits Stored                        US  g_BitsStored
0028x  0102x  IMG High Bit                           US  g_HighBit
0028x  0103x  IMG Pixel Representation               US  g_PixelRepresentation
0028x  0106x  IMG Smallest Image Pixel Value         US  g_SmallestImagePixelValue
0028x  0107x  IMG Largest Image Pixel Value          US  g_LargestImagePixelValue
0028x  1055x  IMG Window Center & Width Explanation  LO  g_WindowCenterWidthExplanation
0028x  0200x  IMG Image Location                     RT  g_ImageLocation
0028x  1050x  IMG Window Center                      DS  g_WindowCenter
0028x  1051x  IMG Window Width                       DS  g_WindowWidth
7FE0x  0010x  PXL Pixel Data                         OW  (none) ... pixel data

Name:
mrdicom::init
Syntax:
obj = obj_new('mrdicom', filename)
Arguments:
filename
Optional. Specifies a DICOM3.0 file. If set, the file is read upon
instanciation via IDLffDicom->read. If reading fails, the object is not
created and obj_new will return obj_new()
Description:
Instanciates an mrdicom object.
Important
You have to call mrdicom_setUIDs before instanciating the first mrdicom
object, or instanciation will fail.

Name:
mrdicom_setUIDs
Syntax:
mrdicom_setUIDs, imageType, implementationClassUID
Arguments:
imageType
One of 'mrimg', 'mrspec', 'ctimg' or 'petimg'. Defines storedSOPClassUID
Default is 'mrimg'. All mrdicom objects within a program share the same
imageType. As of now, this shouldn't hurt much, since only MR image tags
are implemented anyway.
Ok, even setting the image type is a blatant overstatement :)
implementationClassUID
A string - see below.
Description:
This 'class' method needs to be called exactly once in the program
before any instanciation of an mrDicom object as it sets a couple of UIDs
which are specific to your installation and the program. Unless these
variables have been set, all calls to mrdicom::init will fail.
UIDs
Dicom data contains a couple of unique identifiers (UIDs). Some of them
are predefined (e.g. the imageType argument is 'translated' into such a UID),
by a central organization. Three of these identifiers are set here and
used throughout the rest of the code. Some more are set or generated elsewhere.
SOP class UID
This identifier denotes the type of data written (MR images, SPEC images,
and so forth) and is derived from the imageType argument above. The
identifier for MR images e.g. is 1.2.840.10008.5.1.4.1.1.4
Implementation class UID
This is a unique identifier for the application which writes the file.
As this library has no own UID, it is suggested to use either the one
of the machine that generated the images (works for me and our PACS
system) or '0.0.000.00000.0.0.0.0.0.0' (though I have no whether the latter
is ok, and it's a bad idea anyway - see below).
To obtain this number, load a dicom file via IDLffDicom and dumpElements.
META Implementation Class UID (tag 0002,0012) contains the value to use.
SOP instance UID
A unique ID for each single file written. This is automatically created
in mrdicom::write and uses the implementation class UID as a substring.
That's why it is a bad idea to use the '0.0....' option - the UIDs would
not be unique anymore.
Study SOP instance UID
A unique ID for a study. It should be ok to use the same study UID for
derived images. If you want to create a new study UID, use mrdicom::generateUID('study')
Series instance UID
A unique identifier for the series. When writing data with a new series
number, create a new series UID via mrdicom::generateUID('series')
Implementation version name
A string holding information about the program that wrote the file.
This is internally set to something like 'mrDicom-v2.0' (or whatever version)
 
Honestly, I'm not 100% confident of all these UIDs, though it works for
me. Nevertheless - if someone should know about a document that explains all
this service-object pair klimbim and has less pages than the 1200+ of the
dicom standard, I'd be thankful to hear about it.

Name:
mrdicom::cleanup
Description:
The destructor - free image data
YAIF (the sound I made when I learned that one or acronym
for 'yet another IDL feature'):
The cleanup method of any superclass is not called automatically
but needs to be called explicitly from the subclasses' destructor.

Name:
mrdicom::setBasicTags
Syntax:
obj->setBasicTags
Description:
Fills the basic tags necessary for creating a DICOM3.0 file

Name:
mrdicom::copy
Syntax:
obj->copy, source, studyUID=string, seriesUID=string
Arguments:
source
An mrDicom object from which to copy all tag values
studyUID
A string holding a unique study id
seriesUID
A string holding a unique series id
Description:
Copy all tag values, except the image data, from another IDLffDicom or mrdicom
object.
Unique ids
studyUID and seriesUID are identifiers which have to be unique for
each study and series, respectively and must not be mixed up with the
study number or series number (s.b.)
By default, the unique ids are copied from the source dicom object.
If the user writes a new series or study, it is his responsibility to create
new unique ids and either set them via mrdicom::setTagValue (the
field names are rel_study_instance_uid and rel_series_instance_uid) or
provide them here as arguments. Suitable unique ids can be obtained
via mrdicom::generateUID
Do not confuse studyUID/seriesUID (i.e. REL_study/series_instance_UID)
with the fields study_id and series_number, which contain 'human readable'
ids - e.g. a typical value for series_number would be '6' while the
corresponding rel_study_series_UID might be 1.2.840.10008.5.1.4.1.1.4.1234.
However they go hand in hand, i.e. if you save to a new study_id, you should
also create a new studyUID (dito for series)
Copying from a mrdicom object
Please note that the copy function works on the underlying
dicom object directly and bypasses the mrdicom data cache used for writing.
This means that possible changes to data tags on an mrdicom object will not
be taken into account when copying tag values. !This should be changed!
Example:
1) User creates a mrdicom object and reads dicom data from file1
2) User then uses the setTagValue method to change some data
3) User creates a second mrdicom object
4) User copies header data from first mrdicom to second mrdicom object
Any changes done in 2) will not be reflected in 4) as setTagValue works
on an internal cache while header data is copied from the IDLffDicom object
directly. Consequence: This will be solved in a future version.
As for now you are discouraged to use IDLffDicom objects and mrdicom objects
in parallel. Always use mrdicom.

Name:
mrdicom::anonymize
Syntax:
obj->anonymize
Description:
Anonymizes/deletes patient related data from the object

Name:
mrdicom::setImg
Syntax:
obj->setImg, img, /no_copy
Arguments:
img
A pointer to the image, either an [n,m] matrix or a [3,n,m] matrix
in case of true color images
no_copy
Do not create an internal copy of the image data
Description:
Set the image data
By default mrDicom makes an internal copy of the image data. As this
might be an overhead in many cases, this behaviour can be overridden
by setting no_copy to '1'.
However bear in mind that
a) when the mrdicom object is destroyed or
b) a different image is set
the stored image is destroyed.
Example code:
> myimg1 = ptr_new( intarr(256,256), /no_copy )
> myimg2 = ptr_new( intarr(256,256), /no_copy )
> ; alternative 1:
> mrdicom->setImg, myimg1, /no_copy
> mrdicom->setImg, myimg2    ; this will free myimg1!
> ; alternative 2:
> mrdicom->setImg, myimg1
> mrdicom->setImg, myimg2    ; will leave myimg1 intact

Name:
mrdicom::img
Type:
Function
Description:
returns pointer to the image data or ptr_new() if no image data present

Name:
mrdicom::setTagValue
Syntax:
obj->setTagValue, tagname, value
Arguments:
tagname
A string - one of the list below
value
The value to set of appropriate type
Description:
Fill a DICOM data element with the corresponding value.
There is absolutely no error checking whatsoever - esp. no checking
whether the filled data value matches the DICOM tag's value representation
(i.e. type). It is the user's responsibility alone that VR and
value match.
Here's a full list of available data tags - the tag names should
be pretty self explanatory:
Tag list:
Meta tags (x0002) (reading only!)
meta_group_length                    meta_file_meta_information_version
meta_media_stored_sop_class_uid      meta_media_stored_sop_instance_uid
meta_transfer_syntax_uid             meta_implementation_class_uid
meta_implementation_version_name     meta_source_application_entity_title
General module attributes (x0008)
id_specific_character_set            id_image_type
id_sop_class_uid                     id_sop_instance_uid
id_study_date                        id_series_date
id_acquisition_date                  id_image_date
id_study_time                        id_series_time
id_acquisition_time                  id_image_time
id_accession_number                  id_modality
id_manufacturer                      id_institution_name
id_institution_address               id_referring_physicians_name
id_station_name                      id_study_description
id_series_description                id_operators_name
id_manufacturer_model_name           id_referenced_study_component_sequence
id_referenced_sop_class_uid          id_referenced_sop_instance_uid
id_referenced_image_sequence
Patient tags (x0010):
pat_patient_name                     pat_patient_id
pat_patient_birthdate                pat_patient_sex
pat_patient_age                      pat_patient_weight
pat_medical_alerts                   pat_pregnancy_status
pat_patient_comments
Acquisition tags (x0018)
acq_contrast_bolus_agent             acq_body_part_examined
acq_scanning_sequence                acq_sequence_variant
acq_scan_options                     acq_mr_acquisition_type
acq_sequence_name                    acq_angio_flag
acq_slice_thickness                  acq_inversion_time
acq_repetition_time                  acq_echo_time
acq_number_of_averages               acq_imaging_frequency
acq_imaged_nucleus                   acq_echo_number
acq_magnetic_field_strength          acq_spacing_between_slices
acq_number_of_phase_encoding_steps   acq_echo_train_length
acq_percent_sampling                 acq_percent_phase_field_of_view
acq_pixel_bandwidth                  acq_device_serial_number
acq_software_version                 acq_protocol_name
acq_contrast_bolus_volume            acq_date_of_last_calibration
acq_time_of_last_calibration         acq_receiving_coil
acq_transmitting_coil                acq_phase_encoding_direction
acq_flip_angle                       acq_variable_flip_angle
acq_sar                              acq_db_dt
acq_patient_position
Relating tags (x0020)
rel_study_instance_uid               rel_series_instance_uid
rel_study_id                         rel_series_number
rel_acquisition_number               rel_image_number
rel_image_position                   rel_image_position_patient
rel_image_orientation                rel_image_orientation_patient
rel_location                         rel_frame_of_reference_uid
rel_image_geometry_type              rel_masking_image
rel_acquisitions_in_series           rel_position_reference_indicator
rel_slice_location                   rel_image_comments
Image tags (x0028)
img_samples_per_pixel                img_photometric_interpretation
img_image_dimensions                 img_planar_configuration
img_rows                             img_columns
img_pixel_spacing                    img_image_format
img_bits_allocated                   img_bits_stored
img_high_bit                         img_pixel_representation
img_smallest_image_pixel_value       img_largest_image_pixel_value
img_window_center_width_explanation  img_image_location
img_window_center                    img_window_width

Name:
mrdicom::getTagValue
Syntax:
value = obj->getTagValue( tagname )
Arguments:
tagname
String (case insensitive) - one of the list above.
Return value:
The value of the corresponding field
Description:
For a list of available tagnames see mrdicom::setTagValue

Name:
mrdicom::filename
Syntax:
filename = obj->filename()
Return value:
Returns the filename associated with this object. If the object has
been newly created and no data has been loaded yet (or written),
the function returns an empty string

Name:
mrdicom::read
Syntax:
res = obj->read( filename, ... )
Arguments:
same as IDLffDicom::read
Description:
overloaded IDLffDicom::read to store filename and for some
internal bookkeeping
Return value:
0 in the case of error, 1 if success

Name:
mrdicom::write
Syntax:
res = obj->write( filename, /flip, studyUID=string, seriesUID=string )
Arguments:
string filename    : the filename to write to
flip      = int    : flag whether to (rotate, 7) the image before writing
studyUID  = string : a user supplied studyID
seriesUID = string : a user supplied seriesID
Return value:
1 if ok, else 0 - check errno and errmsg in the latter case
Description:
Write image data in DICOM format to disk. For a explanation of studyUID
and seriesUID see mrdicom::copy. The presence of these arguments
here provides the possibility for fast writing of a sequence of images
via the same mrdicom object.
The method automatically generates a unique SOP_Inst_UID for each image.
Known Bug: if an integer or floating point value equals zero and is not
mandatory, it will not be written to the file! However the quantities
for which this holds true do not make sense with values of '0' (except
for pregnancy status), so this should not hurt much.

Name:
mrdicom::generateUID
Syntax:
uid = obj->generateUID( type )
Arguments:
type
String, one of 'image', 'study' or 'series'
Description:
Create unique ids to be used with mrdicom::copy and mrdicom::write
The 'image' option is essentially private: the writing routine will
automatically create a unique image id for each written image.
Example code:
uniqueStudyID  = dicomobj->generateUID('study')
uniqueSeriesID = dicomobj->generateUID('series')

Name:
mrdicom::getbytes
Arguments:
val, num
Description:
byteorder the data due to different processors. Note: big endian ONLY.

Name:
mrdicom::generate_anytag
Arguments:
group, element, data, STR = str
Description:
generate data tag to write

Name:
mrdicom::setVRtag
Arguments:
group, element, VR, data
Description:
sets the data type for a given header data element
oth: added explanations and removed a couple of typos
Explicit layout:
tag (2*16bit), vr(2 chars), length(16bit uint), value (even byte length)
for OB,OW,OF,SQ,UT and UN, length is x00, followed by ulong (32bit) for length
Implicit layout:
tag (2*16bit), length (32 bit unsigned int), value (even byte length)
vr is a two byte character string as below
length is 16 or 32 bit, depending on VR and whether VR is
explicit or implicit, ffffffff means undefined
value: even length
Little endian (the dicom default encoding):
binary numbers: least significant byte encoded first, than in increasing order of significance
strings       : encoded from left to right
Big endian:
binary numbers: most significant byte encoded first, then decreasing significance
strings       : encoded from left to right
Length of type 1 data types must not be zero, absence of type 1 data types
is a protocol violation
!!! we rely on little endian format for the /explicit stuff!
explicit is only supported for the VR types of the meta tags
for the rest we write implicit transfer syntax (i.e. no VRs)

Name:
mrdicom::generate_pixeltag
Arguments:
group, element, val
Description:
generate pixel tag
we don't handle any overlay data elements here [60xx,3000], but
only the pixel tag [7FE0,0010].
VR is OW or OB, depending on the negotiated transfer syntax
OB shall be unaffected by byte ordering
Important other data elements are
[0028,0100] bits allocated - defines size of pixel in bits, must be 8 or 16
[0028,0101] bits stored    - 8 for '8' allocated, 12 or 16 for '16' allocated
[0028,0102] high bit       - shall be one less than bits stored
Overlay images:
bits stored is always '1', overlay images always heva sn image depth of '1'
bits allocated [60xx,0100]; bit position [60cc,0102]

Name:
mrdicom::fillCache
Syntax:
obj->fillCache
Description:
Private! Fills the tag values from the DICOM object into cache.
It might be the case that the user starts a new dicom file 'from scratch'
in which case no dicom data is present from which we might fill the cache.
Also in this case, the internal data cache is rated as 'valid' after
trying to fill the cache.

Name:
mrdicom::errno
Type:
Function
Return value:
Returns the error number of last write command (0 if ok)

Name:
mrdicom::errMsg
Type:
Function
Return value:
Returns the error description of last write command (empty string if ok)

Name:
mrdicom__define
Type:
Private Procedure (constructor)

Last modified: Mon Nov 29 13:30:05 2004