Public Member Functions | |
Image2Dcm () | |
Constructor, initializes command line options. | |
OFCondition | convert (I2DImgSource *inputPlug, I2DOutputPlug *outPlug, DcmDataset *&resultDset, E_TransferSyntax &proposedTS) |
Start the conversion. | |
void | setTemplateFile (const OFString &file) |
Sets a DICOM file that should serve as a template for the resulting DICOM object. | |
void | setSeriesFrom (const OFString &file) |
Set file from which patient/study/series data should be imported from. | |
void | setStudyFrom (const OFString &file) |
Set file from which patient/study/series data should be imported from. | |
void | setIncrementInstanceNumber (OFBool incInstNo) |
Enables/Disables incrementing instance number taken over from DICOM file. | |
void | setISOLatin1 (OFBool insertLatin1) |
Enables/disables autotmatic insertion of the value "ISO_IR100" as a value for the Specific Character Set attribute. | |
void | setOverrideKeys (const OFList< OFString > &ovkeys) |
Specifies some attributes that should be inserted after conversion. | |
void | setValidityChecking (OFBool doChecks, OFBool insertMissingType2=OFTrue, OFBool inventMissingType1=OFTrue) |
Enable/Disable basic validity checks for output dataset. | |
~Image2Dcm () | |
Destructor, frees plugin memory. | |
Protected Member Functions | |
void | cleanupTemplate (DcmDataset *targetDset) |
Cleans up template for future insertion of pixel data information, ie generally removes attributes from image pixel module. | |
OFCondition | applyStudyOrSeriesFromFile (DcmDataset *targetDset) |
Parses patient/study/series level attributes from file as defined on command line and fills internal attributes accordingly. | |
OFCondition | incrementInstanceNumber (DcmDataset *targetDset) |
Increments instance number in given dataset. | |
OFCondition | generateUIDs (DcmDataset *dset) |
Generates and inserts missing UIDs, ie UIDs not taken over from --dataset-from --study from and --series-from options. | |
OFCondition | readAndInsertPixelData (I2DImgSource *imageSource, DcmDataset *dset, E_TransferSyntax &outputTS) |
Reads pixel data and corresponding attributes like rows etc. | |
OFString | isValid (DcmDataset &dataset) const |
Do some completeness / validity checks. | |
OFCondition | applyOverrideKeys (DcmDataset *outputDset) |
Copy override keys over existing keys in given dataset. | |
OFCondition | insertLatin1 (DcmDataset *outputDset) |
Inserts "ISO_IR100" in the attribute "Specific Character Set". | |
OFString | checkAndInventType1Attrib (const DcmTagKey &key, DcmDataset *targetDset, const OFString &defaultValue="") const |
Check whether given type 1 attribute is present and has a length > 0. | |
OFString | checkAndInventType2Attrib (const DcmTagKey &key, DcmDataset *targetDset) const |
Inserts an empty element with the given tag into a dataset. | |
Private Member Functions | |
OFCondition | insertEncapsulatedPixelData (DcmDataset *dset, char *pixData, Uint32 length, const E_TransferSyntax &outputTS) const |
Correctly inserts encapsulated pixel data. | |
Private Attributes | |
OFList< OFString > | m_overrideKeys |
These attributes are applied to the dataset after conversion (and are not checked by the isValid() function). | |
OFString | m_templateFile |
If not empty, the DICOM file specified in this variable is used as a base for the DICOM image file to be created, ie. | |
OFBool | m_readStudyLevel |
If true, patient and study data is read from file. | |
OFBool | m_readSeriesLevel |
If true, patient, study and series data is read from file. | |
OFString | m_studySeriesFile |
File to read study and series from. | |
OFBool | m_incInstNoFromFile |
If true, Instance Number ist read from file and incremented by 1. | |
OFBool | m_disableAttribChecks |
If true, some simple attribute checks (missing type 2 attributes or missing type 1 values) are omitted. | |
OFBool | m_inventMissingType2Attribs |
If true, missing type 2 elements are inserted automatically (empty value). | |
OFBool | m_inventMissingType1Attribs |
If true, missing type 1 elements are inserted automatically with a predefined value, if possible. | |
OFBool | m_insertLatin1 |
If enabled, ISO_IR100 (ISO Latin 1) is inserted as a standard value for attribute "Specific Character Set". |
Definition at line 39 of file i2d.h.
Image2Dcm::Image2Dcm | ( | ) |
Constructor, initializes command line options.
Image2Dcm::~Image2Dcm | ( | ) |
Destructor, frees plugin memory.
OFCondition Image2Dcm::convert | ( | I2DImgSource * | inputPlug, | |
I2DOutputPlug * | outPlug, | |||
DcmDataset *& | resultDset, | |||
E_TransferSyntax & | proposedTS | |||
) |
Start the conversion.
Needs a fully configured input plugin and a fully configured output plugin to operate. Returns a dataset with the resulting DICOM object.
inputPlug | - [in] The input plugin to read pixel data | |
outPlug | - [in] The output plugin for specific SOP class output | |
resultDset | - [out] The DICOM object resulting from the conversion | |
proposedTS | - [out] The proposed transfer syntax (needed e. g. by JPEG input plugin) |
void Image2Dcm::setTemplateFile | ( | const OFString & | file | ) |
Sets a DICOM file that should serve as a template for the resulting DICOM object.
Only the dataset of the given file is imported.
file | - [in] The filename of the template DICOM file |
void Image2Dcm::setSeriesFrom | ( | const OFString & | file | ) |
Set file from which patient/study/series data should be imported from.
file | - [in] The DICOM file to read from |
void Image2Dcm::setStudyFrom | ( | const OFString & | file | ) |
Set file from which patient/study/series data should be imported from.
file | - [in] The DICOM file to read from |
void Image2Dcm::setIncrementInstanceNumber | ( | OFBool | incInstNo | ) |
Enables/Disables incrementing instance number taken over from DICOM file.
This can either be a the study/series file or the template file provided.
incInstNo | - [in] If true, the instance number will be incremented |
void Image2Dcm::setISOLatin1 | ( | OFBool | insertLatin1 | ) |
Enables/disables autotmatic insertion of the value "ISO_IR100" as a value for the Specific Character Set attribute.
If disabled, no value is inserted for Specifific Character Set but instead must be provided by other means (see setTemplateFile(), setSeriesFrom(), setStudyFrom(), setOverrideKeys()). The insertion is applied after loading the (optional) template file; the value might be overwritten by the value copied by setStudy/Series/OverrideKeys.
insertLatin1 | - [in] Enable/disable insertion of Iso Latin 1 |
Specifies some attributes that should be inserted after conversion.
They will override any identical attributes already existing in the converted result DICOM object. The override keys are applied at the very end of the conversion and do not undergoe any validity checking.
ovkeys | [in] override keys that can be tags, dictionary names and paths (see DcmPath for syntax). Also it is permitted to set a value if appropriate, e. g. "PatientName=Doe^John" would be a valid override key. |
void Image2Dcm::setValidityChecking | ( | OFBool | doChecks, | |
OFBool | insertMissingType2 = OFTrue , |
|||
OFBool | inventMissingType1 = OFTrue | |||
) |
Enable/Disable basic validity checks for output dataset.
doChecks | - [in] OFTrue enables checking, OFFalse turns it off. | |
insertMissingType2 | - [in] If true (default), missing type 2 attributes are inserted automatically | |
inventMissingType1 | - [in] If true , missing type 1 attributes are inserted automatically with a predefined value (if possible). An existing empty type 1 attribute is assigned a value, too. |
void Image2Dcm::cleanupTemplate | ( | DcmDataset * | targetDset | ) | [protected] |
Cleans up template for future insertion of pixel data information, ie generally removes attributes from image pixel module.
targetDset | - [out] The dataset that should be cleand up |
OFCondition Image2Dcm::applyStudyOrSeriesFromFile | ( | DcmDataset * | targetDset | ) | [protected] |
Parses patient/study/series level attributes from file as defined on command line and fills internal attributes accordingly.
targetDset | - [out] The dataset to write the attributes to |
OFCondition Image2Dcm::incrementInstanceNumber | ( | DcmDataset * | targetDset | ) | [protected] |
Increments instance number in given dataset.
targetDset | - [in/out] Dataset to increment instance number in |
OFCondition Image2Dcm::generateUIDs | ( | DcmDataset * | dset | ) | [protected] |
Generates and inserts missing UIDs, ie UIDs not taken over from --dataset-from --study from and --series-from options.
dset | - [in] The dataset to write the UIDs to |
OFCondition Image2Dcm::readAndInsertPixelData | ( | I2DImgSource * | imageSource, | |
DcmDataset * | dset, | |||
E_TransferSyntax & | outputTS | |||
) | [protected] |
Reads pixel data and corresponding attributes like rows etc.
from image file and inserts them into dataset.
imageSource | - [in] The input plugin that actually reads the pixel data | |
dset | - [out] The dataset to export the pixel data attributes to | |
outputTS | - [out] The proposed transfex syntax of the dataset |
OFString Image2Dcm::isValid | ( | DcmDataset & | dataset | ) | const [protected] |
Do some completeness / validity checks.
Should be called when dataset is completed and is about to be saved.
dataset | - [in] The dataset to check |
OFCondition Image2Dcm::applyOverrideKeys | ( | DcmDataset * | outputDset | ) | [protected] |
Copy override keys over existing keys in given dataset.
outputDset | - [out] dataset to which the override keys are copied |
OFCondition Image2Dcm::insertLatin1 | ( | DcmDataset * | outputDset | ) | [protected] |
Inserts "ISO_IR100" in the attribute "Specific Character Set".
Overwrites any existing value.
outputDset | - [out] The dataset to write to |
OFString Image2Dcm::checkAndInventType1Attrib | ( | const DcmTagKey & | key, | |
DcmDataset * | targetDset, | |||
const OFString & | defaultValue = "" | |||
) | const [protected] |
Check whether given type 1 attribute is present and has a length > 0.
key | - [in] The attribute tag check | |
targetDset | - [out] targetDset | |
defaultValue | - [in] value to be inserted if attribute is missing (needs invent option for type 1 attributes enabled) |
OFString Image2Dcm::checkAndInventType2Attrib | ( | const DcmTagKey & | key, | |
DcmDataset * | targetDset | |||
) | const [protected] |
Inserts an empty element with the given tag into a dataset.
key | - [in] The attribute tag to check | |
targetDset | - [out] targetDset |
OFCondition Image2Dcm::insertEncapsulatedPixelData | ( | DcmDataset * | dset, | |
char * | pixData, | |||
Uint32 | length, | |||
const E_TransferSyntax & | outputTS | |||
) | const [private] |
Correctly inserts encapsulated pixel data.
dset | [in] - The dataset to which we should add this. | |
pixData | [in] - The data to add. | |
length | [in] - The length of pixData. | |
outputTS | [in] - The output transfer syntax to be used |
OFString Image2Dcm::m_templateFile [private] |
OFBool Image2Dcm::m_inventMissingType2Attribs [private] |
OFBool Image2Dcm::m_inventMissingType1Attribs [private] |
OFBool Image2Dcm::m_insertLatin1 [private] |