Medical Imaging Interaction Toolkit
2023.12.00
Medical Imaging Interaction Toolkit
|
Split inputs into blocks of equidistant slices (for use in DICOMITKSeriesGDCMReader). More...
#include <mitkEquiDistantBlocksSorter.h>
Classes | |
class | SliceGroupingAnalysisResult |
Return type of AnalyzeFileForITKImageSeriesReaderSpacingAssumption(). More... | |
Public Member Functions | |
mitkClassMacro (EquiDistantBlocksSorter, DICOMDatasetSorter) | |
DICOMTagList | GetTagsOfInterest () override |
Return the tags of interest (to facilitate scanning) More... | |
void | Sort () override |
Delegates work to AnalyzeFileForITKImageSeriesReaderSpacingAssumption(). AnalyzeFileForITKImageSeriesReaderSpacingAssumption() is called until it does not create multiple blocks anymore. More... | |
void | SetAcceptTilt (bool accept) |
Whether or not to accept images from a tilted acquisition in a single output group. More... | |
bool | GetAcceptTilt () const |
void | SetToleratedOriginOffsetToAdaptive (double fractionOfInterSliceDistanct=0.3) |
See class description and SetToleratedOriginOffset(). More... | |
void | SetToleratedOriginOffset (double millimeters=0.005) |
See class description and SetToleratedOriginOffsetToAdaptive(). More... | |
double | GetToleratedOriginOffset () const |
bool | IsToleratedOriginOffsetAbsolute () const |
void | SetAcceptTwoSlicesGroups (bool accept) |
bool | GetAcceptTwoSlicesGroups () const |
void | PrintConfiguration (std::ostream &os, const std::string &indent="") const override |
Print configuration details into stream. More... | |
bool | operator== (const DICOMDatasetSorter &other) const override |
Public Member Functions inherited from mitk::DICOMDatasetSorter | |
mitkClassMacroItkParent (DICOMDatasetSorter, itk::LightObject) | |
void | SetInput (DICOMDatasetList filenames) |
Input for sorting. More... | |
const DICOMDatasetList & | GetInput () const |
Input for sorting. More... | |
unsigned int | GetNumberOfOutputs () const |
Output of the sorting process. More... | |
const DICOMDatasetList & | GetOutput (unsigned int index) const |
Output of the sorting process. More... | |
DICOMDatasetList & | GetOutput (unsigned int index) |
Output of the sorting process. More... | |
Static Public Member Functions | |
static Pointer | New () |
Protected Types | |
typedef std::vector< SliceGroupingAnalysisResult > | ResultsList |
Protected Member Functions | |
SliceGroupingAnalysisResult | AnalyzeFileForITKImageSeriesReaderSpacingAssumption (const DICOMDatasetList &files, bool groupsOfSimilarImages) |
Ensure an equal z-spacing for a group of files. More... | |
std::string | ConstCharStarToString (const char *s) |
Safely convert const char* to std::string. More... | |
EquiDistantBlocksSorter () | |
~EquiDistantBlocksSorter () override | |
EquiDistantBlocksSorter (const EquiDistantBlocksSorter &other) | |
EquiDistantBlocksSorter & | operator= (const EquiDistantBlocksSorter &other) |
Protected Member Functions inherited from mitk::DICOMDatasetSorter | |
DICOMDatasetSorter () | |
~DICOMDatasetSorter () override | |
DICOMDatasetSorter (const DICOMDatasetSorter &other) | |
DICOMDatasetSorter & | operator= (const DICOMDatasetSorter &other) |
void | ClearOutputs () |
void | SetNumberOfOutputs (unsigned int numberOfOutputs) |
void | SetOutput (unsigned int index, const DICOMDatasetList &output) |
Protected Attributes | |
bool | m_AcceptTilt |
ResultsList | m_SliceGroupingResults |
double | m_ToleratedOriginOffset |
bool | m_ToleratedOriginOffsetIsAbsolute |
bool | m_AcceptTwoSlicesGroups |
Split inputs into blocks of equidistant slices (for use in DICOMITKSeriesGDCMReader).
Since inter-slice distance is not recorded in DICOM tags, we must ensure that blocks are made up of slices that have equal distances between neighboring slices. This is especially necessary because itk::ImageSeriesReader is later used for the actual loading, and this class expects (and does nocht verify) equal inter-slice distance (see Forced Configuration).
To achieve such grouping, the inter-slice distance is calculated from the first two different slice positions of a block. Following slices are added to a block as long as they can be added by adding the calculated inter-slice distance to the last slice of the block. Slices that do not fit into the expected distance pattern, are set aside for further analysis. This grouping is done until each file has been assigned to a group.
Slices that share a position in space are also sorted into separate blocks during this step. So the result of this step is a set of blocks that contain only slices with equal z spacing and unique slices at each position.
During sorting, the origins (documented in tag image position patient) are compared against expected origins (from former origin plus moving direction). As there will be minor differences in numbers (from both calculations and imprecise tag values), we must be a bit tolerant here. The default behavior is to expect that an origin is not further away from the expected position than 30% of the inter-slice distance. To support a legacy behavior of a former loader (DicomSeriesReader), this default can be restricted to a constant number of millimeters by calling SetToleratedOriginOffset(mm).
Detailed implementation in AnalyzeFileForITKImageSeriesReaderSpacingAssumption().
Definition at line 53 of file mitkEquiDistantBlocksSorter.h.
|
protected |
Definition at line 200 of file mitkEquiDistantBlocksSorter.h.
|
protected |
|
overrideprotected |
|
protected |
|
protected |
Ensure an equal z-spacing for a group of files.
Takes as input a number of images, which are all equally oriented and spatially sorted along their normal direction.
Internally used by GetSeries. Returns two lists: the first one contins slices of equal inter-slice spacing. The second list contains remaining files, which need to be run through AnalyzeFileForITKImageSeriesReaderSpacingAssumption again.
Relevant code that is matched here is in itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
|
protected |
Safely convert const char* to std::string.
bool mitk::EquiDistantBlocksSorter::GetAcceptTilt | ( | ) | const |
bool mitk::EquiDistantBlocksSorter::GetAcceptTwoSlicesGroups | ( | ) | const |
|
overridevirtual |
Return the tags of interest (to facilitate scanning)
Implements mitk::DICOMDatasetSorter.
double mitk::EquiDistantBlocksSorter::GetToleratedOriginOffset | ( | ) | const |
bool mitk::EquiDistantBlocksSorter::IsToleratedOriginOffsetAbsolute | ( | ) | const |
mitk::EquiDistantBlocksSorter::mitkClassMacro | ( | EquiDistantBlocksSorter | , |
DICOMDatasetSorter | |||
) |
|
static |
|
protected |
|
overridevirtual |
Implements mitk::DICOMDatasetSorter.
|
overridevirtual |
Print configuration details into stream.
Implements mitk::DICOMDatasetSorter.
void mitk::EquiDistantBlocksSorter::SetAcceptTilt | ( | bool | accept | ) |
Whether or not to accept images from a tilted acquisition in a single output group.
void mitk::EquiDistantBlocksSorter::SetAcceptTwoSlicesGroups | ( | bool | accept | ) |
void mitk::EquiDistantBlocksSorter::SetToleratedOriginOffset | ( | double | millimeters = 0.005 | ) |
See class description and SetToleratedOriginOffsetToAdaptive().
Default value of 0.005 is calculated so that we get a maximum of 1/10mm error when having a measurement crosses 20 slices in z direction (too strict? we don't know better..).
void mitk::EquiDistantBlocksSorter::SetToleratedOriginOffsetToAdaptive | ( | double | fractionOfInterSliceDistanct = 0.3 | ) |
See class description and SetToleratedOriginOffset().
|
overridevirtual |
Delegates work to AnalyzeFileForITKImageSeriesReaderSpacingAssumption(). AnalyzeFileForITKImageSeriesReaderSpacingAssumption() is called until it does not create multiple blocks anymore.
Implements mitk::DICOMDatasetSorter.
|
protected |
Definition at line 198 of file mitkEquiDistantBlocksSorter.h.
|
protected |
Definition at line 206 of file mitkEquiDistantBlocksSorter.h.
|
protected |
Definition at line 201 of file mitkEquiDistantBlocksSorter.h.
|
protected |
Definition at line 203 of file mitkEquiDistantBlocksSorter.h.
|
protected |
Definition at line 204 of file mitkEquiDistantBlocksSorter.h.