DCMTK
Version 3.6.7
OFFIS DICOM Toolkit
|
Class for scanning files for concatenations and if desired, load one of them. More...
Classes | |
struct | Failure |
structure representing error information about a failed file More... | |
struct | Info |
Structure representing information about a Concatenation, consisting of its instances and common data. More... | |
Public Types | |
typedef OFMap< OFString, ConcatenationLoader::Info * > | TScanResult |
Result type of scan() | |
typedef OFMap< OFString, ConcatenationLoader::Info * >::iterator | ScanResultIt |
Iterator type for iterating over scan() results. | |
typedef OFList< Failure > | TScanFailures |
Result type for the failures reported by scan() | |
Public Member Functions | |
typedef | OFListIterator (Failure) TScanFailureIt |
Result type for iterating the failures reported by scan() | |
ConcatenationLoader () | |
Constructor. | |
virtual | ~ConcatenationLoader () |
Virtual destructor. | |
virtual void | setIgnoreMissingSourceUID (const OFBool ignore) |
Ignore missing SOP Instance UID of Concatenation Source. More... | |
virtual OFCondition | scan (const OFList< OFFilename > &files) |
Scan given list of files for Concatenations. More... | |
virtual OFCondition | scan (const OFFilename &directory, const OFFilename &pattern="*", OFBool recursive=OFTrue) |
Scan given directory for Concatenations. More... | |
virtual const TScanResult & | getInfo () |
Get successful results of scan() operation. More... | |
virtual const TScanFailures & | getFailedFiles () |
Get failed files of scan() operation. More... | |
virtual OFCondition | load (const OFString &concatenationUID, DcmDataset *dataset, OFVector< DcmIODTypes::Frame * > &frames) |
Load Concatenation and merge it into "original" source dataset. More... | |
Protected Member Functions | |
virtual void | handleFile (const OFFilename &file, ConcatenationLoader::Info &info) |
Handles single file of a Concatenation and extracts structure for later access by the user. More... | |
virtual void | checkAndInsertInfo (const ConcatenationLoader::Info &info, const ConcatenationLoader::Info::Instance &inst, OFString &error) |
Checks an current file's information whether it fits to the rest of the Concatenation instances already read. More... | |
virtual OFBool | zeroOrEqual (const size_t num1, const size_t num2) |
Check whether two numbers equal to 0 or empty. More... | |
virtual OFBool | emptyOrEqual (const OFString &str1, const OFString &str2) |
Check whether two strings are equal or one of them is empty. More... | |
template<typename T > | |
T | getNotZero (const T num1, const T num2) |
Get that number from both which is not 0. More... | |
virtual OFCondition | doScanFinalChecks () |
Perform consistency checks on the Concatenations found. More... | |
virtual OFCondition | prepareTemplate (Info &firstInstance) |
Prepare template (dataset) that is used to represent the final result dataset. More... | |
virtual OFCondition | extractFrames (DcmItem &item, Info &info, Uint32 numFrames) |
Extract frames from given item. More... | |
virtual OFCondition | extractBinaryFrames (DcmItem &item, Info &info, Uint32 numFrames) |
Extract binary frames (Bits Allocated = 1) from given item. More... | |
virtual OFCondition | deleteConcatAttributes (DcmItem &item) |
Deletes those concatenation attributes from given item that are not used or get a different value in the resulting merged dataset. More... | |
virtual OFCondition | movePerFrameItems (DcmItem &item) |
Moves all Per-Frame Functional Group items found in given item to result instance. More... | |
virtual OFCondition | insertDestinationAttributes () |
Insert/adapt attributes that are required with the merged result instance. More... | |
Private Attributes | |
TScanResult | m_Concats |
Map with entries consisting each of ConcatenationUID and related Concatenation information. | |
TScanFailures | m_FailedFiles |
List with failed files, each entry consisting of filename, error text and SOP Instance UID (latter might be empty). | |
OFBool | m_ignoreMissingSourceUID |
If OFTrue, the missing of attribute SOP Instance UID of Concatenation Source is ignored and will not lead to an error. | |
DcmDataset * | m_Result |
The dataset that will contain the final merged SOP instance produced by the load() method. More... | |
OFVector< DcmIODTypes::Frame * > | m_Frames |
The frames that will contain all the frames of the merged SOP instance produced by the load() method. More... | |
Class for scanning files for concatenations and if desired, load one of them.
If successful, loading produces the merged SOP Instance as a single dataset plus its frames in a separate data structure. The following workflow must be used:
|
protectedvirtual |
Checks an current file's information whether it fits to the rest of the Concatenation instances already read.
If this is the case, the instance's information is added to the results.
info | Information for this Concatenation |
inst | Instance information that should be added to the Concatenation |
error | Error, if instance cannot be processed/added, otherwise empty. |
|
protectedvirtual |
Deletes those concatenation attributes from given item that are not used or get a different value in the resulting merged dataset.
item | The item to delete from |
|
protectedvirtual |
Perform consistency checks on the Concatenations found.
|
protectedvirtual |
Check whether two strings are equal or one of them is empty.
str1 | The first string |
str2 | The second string |
|
protectedvirtual |
Extract binary frames (Bits Allocated = 1) from given item.
The resulting frames are stored in member variable.
item | The item to read Pixel Data attribute from |
info | Concatenation information providing pixel meta data like Rows and Columns |
numFrames | The number of frames to extract from item's Pixel Data attribute |
|
protectedvirtual |
Extract frames from given item.
Works for Bits Allocated = 8 and Bits Allocated = 16. Resulting frames are stored in member variable.
item | The item to read Pixel Data attribute from |
info | Concatenation information providing pixel meta data like Rows and Columns |
numFrames | The number of frames to extract from item's Pixel Data attribute |
|
virtual |
|
virtual |
|
protected |
Get that number from both which is not 0.
num1 | The first number |
num2 | The second number |
|
protectedvirtual |
Handles single file of a Concatenation and extracts structure for later access by the user.
file | The file to process |
info | The concatenation information structure to store results to |
|
protectedvirtual |
Insert/adapt attributes that are required with the merged result instance.
|
virtual |
Load Concatenation and merge it into "original" source dataset.
The Concatenation to be loaded is selected by its Concatenation UID. Frames are not written to the dataset's Pixel Data attribute but instead reside in a frame structure provided by the caller (since they could exceed the uncompressed maximum of 4 GB allowed in a single dataset).
concatenationUID | The Concatenation UID of the Concatenation to be loaded |
dataset | The result dataset. The caller must hand in a pointer to a valid dataset, i.e. memory allocation must be done by the caller. During loading, the dataset must not be freed outside this class. However, the caller stays responsible to delete the dataset after usage. |
frames | The resulting frames. Vector should provided empty by the user. The user is responsible for deleting frames after successful operation. If load() fails, this parameter should return an empty vector. |
|
protectedvirtual |
Moves all Per-Frame Functional Group items found in given item to result instance.
item | The item to delete from |
|
protectedvirtual |
Prepare template (dataset) that is used to represent the final result dataset.
firstInstance | The first (or any instance) of the concatenation instances that will be used to create the result dataset. |
|
virtual |
Scan given directory for Concatenations.
If successful, a results can be accessed by calling getInfo() which contains an overview of the Concatenations found (and files that failed during reading).
directory | The directory to scan |
pattern | The search pattern (* per default) |
recursive | If OFTrue, sub directories are scanned, too (default: OFTrue) |
|
virtual |
Scan given list of files for Concatenations.
If successful, a results can be accessed by calling getInfo() which contains an overview of the Concatenations found (and files that failed during reading).
files | The files to scan |
|
virtual |
Ignore missing SOP Instance UID of Concatenation Source.
ignore | If OFTrue, missing or empty SOP Instance UID of Concatenation Source tag is ignored and operation continues. |
|
protectedvirtual |
Check whether two numbers equal to 0 or empty.
num1 | The first number |
num2 | The second number |
|
private |
|
private |