A class to read and write the header part of a dicom file. More...
#include <vil_dicom_header.h>
Public Member Functions | |
vil_dicom_header_format () | |
~vil_dicom_header_format () | |
bool | isDicomFormat (vil_stream &) |
True if it is known DICOM format. | |
vil_dicom_header_info | readHeader (vil_stream &fs) |
Read the dicom header into a header struct. | |
vil_dicom_header_info | lastHeader (void) |
Method to return the last struct of header info set. | |
bool | headerValid (void) |
Method to indicate if the header info held is valid or not. | |
vil_dicom_header_endian | systemEndian (void) |
Return the current system endian. | |
vil_dicom_header_endian | fileEndian (void) |
Return the endian of the header being read. | |
vil_dicom_header_image_type | imageType (void) |
Return any encapsulated image type. | |
Private Member Functions | |
vil_dicom_header_type | determineFileType (vil_stream &fs) |
Method to determine the file type. | |
void | readHeaderElements (vil_stream &fs) |
Method to read the elements from the header. | |
void | readIdentifyingElements (short element, int dblock_size, vil_stream &fs) |
Method to read the identifying group's details. | |
void | readPatientElements (short element, int dblock_size, vil_stream &fs) |
Method to read the patient details. | |
void | readAcquisitionElements (short element, int dblock_size, vil_stream &fs) |
Method to read the acquisition group's details. | |
void | readRelationshipElements (short element, int dblock_size, vil_stream &fs) |
Method to read the relationship group's details. | |
void | readImageElements (short element, int dblock_size, vil_stream &fs) |
Method to read the image group's details. | |
void | readDelimiterElements (short element, int dblock_size, vil_stream &fs) |
Method to read the delimiter group's details. | |
bool | convertValueRepresentation (unsigned int &dblock_size, vil_stream &ifs) |
Method to convert the Value Representation (VR) (if it exists). | |
bool | pixelDataFound (short group, short element) |
Method to determine whether or not the actual pixel data has been reached. | |
void | clearInfo (void) |
vil_dicom_header_endian | calculateEndian (void) |
Work out whether the current architecture is big or little endian. | |
vil_dicom_header_endian | determineMetaInfo (vil_stream &fs) |
Initialise all the necessary meta-file stuff. | |
vxl_uint_16 | shortSwap (vxl_uint_16 short_in) |
Method to byte swap an unsigned short int if necessary. | |
vxl_uint_32 | intSwap (vxl_uint_32 int_in) |
Method to byte swap an unsigned int if necessary. | |
void | charSwap (char *char_in, int val_size) |
Method to swap a number inside a char array. | |
Private Attributes | |
vil_dicom_header_info | last_read_ |
Holds the info from the last header read. | |
bool | info_valid_ |
TRUE if the header info is valid (i.e. has been read) otherwise FALSE. | |
vil_dicom_header_endian | endian_ |
A variable to hold the discovered architecture endian. | |
vil_dicom_header_endian | file_endian_ |
A variable to hold the current header file's endian. | |
vil_dicom_header_image_type | image_type_ |
A variable to hole the current encapsulate file type (if any). |
A class to read and write the header part of a dicom file.
This class reads and writes the header section of a dicom file, determining the type and storing the information in a dicom structure.
Definition at line 463 of file vil_dicom_header.h.
vil_dicom_header_format::vil_dicom_header_format | ( | ) |
vil_dicom_header_format::~vil_dicom_header_format | ( | ) |
vil_dicom_header_endian vil_dicom_header_format::calculateEndian | ( | void | ) | [private] |
Work out whether the current architecture is big or little endian.
void vil_dicom_header_format::charSwap | ( | char * | char_in, |
int | val_size | ||
) | [private] |
Method to swap a number inside a char array.
char_in | The char array to swap - on exit contains the result |
val_size | The size of the var to swap |
void vil_dicom_header_format::clearInfo | ( | void | ) | [private] |
bool vil_dicom_header_format::convertValueRepresentation | ( | unsigned int & | dblock_size, |
vil_stream & | ifs | ||
) | [private] |
Method to convert the Value Representation (VR) (if it exists).
data_block | Contains the VR or data block size (always holds the data block size on exit |
fs | The file stream to read from |
vil_dicom_header_type vil_dicom_header_format::determineFileType | ( | vil_stream & | fs | ) | [private] |
Method to determine the file type.
fs | The file stream for the image to test |
vil_dicom_header_endian vil_dicom_header_format::determineMetaInfo | ( | vil_stream & | fs | ) | [private] |
Initialise all the necessary meta-file stuff.
vil_dicom_header_endian vil_dicom_header_format::fileEndian | ( | void | ) |
Return the endian of the header being read.
bool vil_dicom_header_format::headerValid | ( | void | ) |
Method to indicate if the header info held is valid or not.
vil_dicom_header_image_type vil_dicom_header_format::imageType | ( | void | ) |
Return any encapsulated image type.
vxl_uint_32 vil_dicom_header_format::intSwap | ( | vxl_uint_32 | int_in | ) | [private] |
Method to byte swap an unsigned int if necessary.
int_in | The unsigned int to swap |
bool vil_dicom_header_format::isDicomFormat | ( | vil_stream & | ) |
True if it is known DICOM format.
vil_dicom_header_info vil_dicom_header_format::lastHeader | ( | void | ) |
Method to return the last struct of header info set.
The class holds a dicom header info struct containing the info from the last dicom file read.
bool vil_dicom_header_format::pixelDataFound | ( | short | group, |
short | element | ||
) | [private] |
Method to determine whether or not the actual pixel data has been reached.
group | The current group to test |
element | The element within that group |
void vil_dicom_header_format::readAcquisitionElements | ( | short | element, |
int | dblock_size, | ||
vil_stream & | fs | ||
) | [private] |
Method to read the acquisition group's details.
Fills the acquisition details in the last_read_ structure from the file header
element | The element being read in the acquisition group |
dblock_size | The size of the data block for this element |
fs | The file stream to read from |
void vil_dicom_header_format::readDelimiterElements | ( | short | element, |
int | dblock_size, | ||
vil_stream & | fs | ||
) | [private] |
Method to read the delimiter group's details.
Certain field in the delimiter group have no data block, and so should not be skipped. This method takes the appropriate action - to skip or not to skip
element | The element being read in the delimiter group |
dblock_size | The size of the data block for this element |
fs | The file stream to read from |
vil_dicom_header_info vil_dicom_header_format::readHeader | ( | vil_stream & | fs | ) |
Read the dicom header into a header struct.
Reads the header section of the dicom file and stores the result in a header struct, which it returns. When finished, the file stream should be pointing at the start of the image data
fs | The file stream to read - on exit points to the start of the image data |
void vil_dicom_header_format::readHeaderElements | ( | vil_stream & | fs | ) | [private] |
Method to read the elements from the header.
This method fills the last_read_ header structure with the necessary fields
fs | The file stream to read from |
void vil_dicom_header_format::readIdentifyingElements | ( | short | element, |
int | dblock_size, | ||
vil_stream & | fs | ||
) | [private] |
Method to read the identifying group's details.
Fills the identifying details in the last_read_ structure from the file header
element | The element being read in the identifying group |
dblock_size | The size of the data block for this element |
fs | The file stream to read from |
void vil_dicom_header_format::readImageElements | ( | short | element, |
int | dblock_size, | ||
vil_stream & | fs | ||
) | [private] |
Method to read the image group's details.
Fills the image details in the last_read_ structure from the file header
element | The element being read in the image group |
dblock_size | The size of the data block for this element |
fs | The file stream to read from |
void vil_dicom_header_format::readPatientElements | ( | short | element, |
int | dblock_size, | ||
vil_stream & | fs | ||
) | [private] |
Method to read the patient details.
Fills the patient details in the last_read_ structure from the file header
element | The element being read in the patient group |
dblock_size | The size of the data block for this element |
fs | The file stream to read from |
void vil_dicom_header_format::readRelationshipElements | ( | short | element, |
int | dblock_size, | ||
vil_stream & | fs | ||
) | [private] |
Method to read the relationship group's details.
Fills the relationship details in the last_read_ structure from the file header
element | The element being read in the relationship group |
dblock_size | The size of the data block for this element |
fs | The file stream to read from |
vxl_uint_16 vil_dicom_header_format::shortSwap | ( | vxl_uint_16 | short_in | ) | [private] |
Method to byte swap an unsigned short int if necessary.
short_in | The unsigned short to swap |
vil_dicom_header_endian vil_dicom_header_format::systemEndian | ( | void | ) |
Return the current system endian.
A variable to hold the discovered architecture endian.
Definition at line 691 of file vil_dicom_header.h.
A variable to hold the current header file's endian.
Definition at line 696 of file vil_dicom_header.h.
A variable to hole the current encapsulate file type (if any).
Definition at line 701 of file vil_dicom_header.h.
bool vil_dicom_header_format::info_valid_ [private] |
TRUE if the header info is valid (i.e. has been read) otherwise FALSE.
Definition at line 686 of file vil_dicom_header.h.
Holds the info from the last header read.
Definition at line 681 of file vil_dicom_header.h.