Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::IOVolumeSplitReason Class Reference

Records the reasons why a DICOM volume was split during loading. More...

#include <mitkIOVolumeSplitReason.h>

Collaboration diagram for mitk::IOVolumeSplitReason:

Public Types

enum class  ReasonType {
  Unknown , ValueSplitDifference , ValueSortDistance , ImagePostionMissing ,
  OverlappingSlices , GantryTiltDifference , SliceDistanceInconsistency , MissingSlices
}
 Enumeration of possible reasons for splitting a DICOM volume. More...
 
using Self = IOVolumeSplitReason
 
using Pointer = std::shared_ptr< IOVolumeSplitReason >
 Shared pointer type. More...
 
using ConstPointer = std::shared_ptr< const IOVolumeSplitReason >
 Shared pointer to const type. More...
 

Public Member Functions

void AddReason (ReasonType type, const std::string &detail="")
 Add a split reason with optional detail text. More...
 
void RemoveReason (ReasonType type)
 Remove a previously added split reason. More...
 
bool HasReasons () const
 Check whether any split reasons have been recorded. More...
 
bool HasReason (ReasonType type) const
 Check whether a specific reason type has been recorded. More...
 
std::string GetReasonDetails (ReasonType type) const
 Get the detail string for a specific reason type. More...
 
Pointer ExtendReason (ConstPointer otherReason) const
 Clone this instance and extend it with reasons from another instance. More...
 
Pointer Clone () const
 Create a deep copy of this instance. More...
 

Static Public Member Functions

static nlohmann::json ToJSON (ConstPointer reason)
 Serialize a split reason to JSON. More...
 
static Pointer FromJSON (const nlohmann::json &j)
 Deserialize a split reason from JSON. More...
 
static std::string TypeToString (ReasonType reasonType)
 Convert a ReasonType to its string representation. More...
 
static IOVolumeSplitReason::ReasonType StringToType (const std::string &reasonStr)
 Convert a string representation to a ReasonType. More...
 
static Pointer New ()
 Create a new, empty IOVolumeSplitReason instance. More...
 

Protected Types

using ReasonMapType = std::map< ReasonType, std::string >
 Map storing reason types and their associated detail strings. More...
 

Protected Attributes

ReasonMapType m_ReasonMap
 

Detailed Description

Records the reasons why a DICOM volume was split during loading.

When DICOM series are loaded, the reader may need to split the input files into multiple volumes. This class captures the specific reasons for each split, along with optional detail strings providing additional context (e.g., the detected distance inconsistency or number of missing slices).

Reasons are stored as a map from ReasonType to a detail string and can be serialized to/from JSON for persistence.

See also
IOVolumeSplitReason::ReasonType

Definition at line 41 of file mitkIOVolumeSplitReason.h.

Member Typedef Documentation

◆ ConstPointer

Shared pointer to const type.

Definition at line 48 of file mitkIOVolumeSplitReason.h.

◆ Pointer

Shared pointer type.

Definition at line 46 of file mitkIOVolumeSplitReason.h.

◆ ReasonMapType

using mitk::IOVolumeSplitReason::ReasonMapType = std::map<ReasonType, std::string>
protected

Map storing reason types and their associated detail strings.

Definition at line 157 of file mitkIOVolumeSplitReason.h.

◆ Self

Member Enumeration Documentation

◆ ReasonType

Enumeration of possible reasons for splitting a DICOM volume.

Enumerator
Unknown 

Unknown or unclassified reason.

ValueSplitDifference 

Split due to different values in splitting-relevant DICOM tags.

ValueSortDistance 

Split due to value distance of sort criterion being too large for relevant DICOM tag(s).

ImagePostionMissing 

Split because the image position tag was missing in one of the compared files.

OverlappingSlices 

Split because at least two input files overlap in world coordinate space.

GantryTiltDifference 

Split because the gantry tilts of at least two input files differ.

SliceDistanceInconsistency 

Split because slice distances are inconsistent (heterogeneous z-spacing or missing slices). Details contain the detected inconsistency value.

MissingSlices 

Split due to missing slices (a sub-class of SliceDistanceInconsistency). Details contain the assumed number of missing slices.

Definition at line 53 of file mitkIOVolumeSplitReason.h.

Member Function Documentation

◆ AddReason()

void mitk::IOVolumeSplitReason::AddReason ( ReasonType  type,
const std::string &  detail = "" 
)

Add a split reason with optional detail text.

Parameters
[in]typeThe reason type to add.
[in]detailOptional detail string providing context (e.g., numeric values).

If the reason type already exists, its detail is overwritten.

◆ Clone()

Pointer mitk::IOVolumeSplitReason::Clone ( ) const

Create a deep copy of this instance.

Returns
A new IOVolumeSplitReason with identical contents.

◆ ExtendReason()

Pointer mitk::IOVolumeSplitReason::ExtendReason ( ConstPointer  otherReason) const

Clone this instance and extend it with reasons from another instance.

Creates a copy of this object, then adds any reason types from otherReason that are not already present in this instance. Existing reason types are not overwritten.

Parameters
[in]otherReasonThe other instance whose reasons to merge.
Returns
A new IOVolumeSplitReason containing the merged reasons.
Precondition
otherReason must point to a valid instance.

◆ FromJSON()

static Pointer mitk::IOVolumeSplitReason::FromJSON ( const nlohmann::json &  j)
static

Deserialize a split reason from JSON.

Parameters
[in]jThe JSON value to parse.
Returns
A new IOVolumeSplitReason populated from the JSON.

◆ GetReasonDetails()

std::string mitk::IOVolumeSplitReason::GetReasonDetails ( ReasonType  type) const

Get the detail string for a specific reason type.

Parameters
[in]typeThe reason type to query.
Returns
The detail string associated with the reason.
Exceptions
mitk::Exceptionif the reason type is not present.

◆ HasReason()

bool mitk::IOVolumeSplitReason::HasReason ( ReasonType  type) const

Check whether a specific reason type has been recorded.

Parameters
[in]typeThe reason type to look for.
Returns
true if the given reason type is present.

◆ HasReasons()

bool mitk::IOVolumeSplitReason::HasReasons ( ) const

Check whether any split reasons have been recorded.

Returns
true if at least one reason is present.

◆ New()

static Pointer mitk::IOVolumeSplitReason::New ( )
static

Create a new, empty IOVolumeSplitReason instance.

Returns
A shared pointer to the new instance.

◆ RemoveReason()

void mitk::IOVolumeSplitReason::RemoveReason ( ReasonType  type)

Remove a previously added split reason.

Parameters
[in]typeThe reason type to remove. No-op if not present.

◆ StringToType()

static IOVolumeSplitReason::ReasonType mitk::IOVolumeSplitReason::StringToType ( const std::string &  reasonStr)
static

Convert a string representation to a ReasonType.

Parameters
[in]reasonStrThe string identifier to parse.
Returns
The corresponding ReasonType, or ReasonType::Unknown if unrecognized.

Referenced by mitk::from_json().

◆ ToJSON()

static nlohmann::json mitk::IOVolumeSplitReason::ToJSON ( ConstPointer  reason)
static

Serialize a split reason to JSON.

Parameters
[in]reasonThe instance to serialize (must not be nullptr).
Returns
A JSON array representing the reasons and their details.
Exceptions
mitk::Exceptionif reason is nullptr.

◆ TypeToString()

static std::string mitk::IOVolumeSplitReason::TypeToString ( ReasonType  reasonType)
static

Convert a ReasonType to its string representation.

Parameters
[in]reasonTypeThe reason type to convert.
Returns
The string identifier (e.g., "missing_slices", "overlapping_slices").

Referenced by mitk::to_json().

Member Data Documentation

◆ m_ReasonMap

ReasonMapType mitk::IOVolumeSplitReason::m_ReasonMap
protected

Definition at line 158 of file mitkIOVolumeSplitReason.h.


The documentation for this class was generated from the following file: