Medical Imaging Interaction Toolkit
2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
|
LabelSetImage class for handling labels and layers in a segmentation session. More...
#include <mitkLabelSetImage.h>
Public Types | |
typedef mitk::Label::PixelType | PixelType |
using | GroupIndexType = std::size_t |
using | LabelValueType = mitk::Label::PixelType |
using | ConstLabelVectorType = ConstLabelVector |
using | LabelVectorType = LabelVector |
using | LabelValueVectorType = std::vector< LabelValueType > |
Public Types inherited from mitk::Image | |
enum | ImportMemoryManagementType { CopyMemory, ManageMemory, ReferenceMemory, DontManageMemory } |
typedef Image | Self |
typedef SlicedData | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
typedef itk::SmartPointer< ImageDataItem > | ImageDataItemPointer |
typedef itk::Statistics::Histogram< double > | HistogramType |
typedef mitk::ImageStatisticsHolder * | StatisticsHolderPointer |
typedef std::vector< ImageDataItemPointer > | ImageDataItemPointerArray |
Vector container of SmartPointers to ImageDataItems; Class is only for internal usage to allow convenient access to all slices over iterators; See documentation of ImageDataItem for details. More... | |
Public Types inherited from mitk::SlicedData | |
typedef SlicedData | Self |
typedef BaseData | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
typedef itk::ImageRegion< RegionDimension > | RegionType |
typedef itk::Index< RegionDimension > | IndexType |
typedef IndexType::IndexValueType | IndexValueType |
typedef itk::Offset< RegionDimension > | OffsetType |
typedef OffsetType::OffsetValueType | OffsetValueType |
typedef itk::Size< RegionDimension > | SizeType |
typedef SizeType::SizeValueType | SizeValueType |
Public Types inherited from mitk::BaseData | |
typedef BaseData | Self |
typedef itk::DataObject | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
Public Types inherited from mitk::Identifiable | |
using | UIDType = std::string |
Public Member Functions | |
mitkClassMacro (LabelSetImage, Image) | |
mitk::Label * | AddLabel (Label *label, GroupIndexType groupID, bool addAsClone=true, bool correctLabelValue=true) |
Adds a label instance to a group of the multi label image. More... | |
mitk::Label * | AddLabelWithContent (Label *label, const Image *labelContent, GroupIndexType groupID, LabelValueType contentLabelValue, bool addAsClone=true, bool correctLabelValue=true) |
Adds a label instance to a group of the multi label image including its pixel content. More... | |
mitk::Label * | AddLabel (const std::string &name, const Color &color, GroupIndexType groupID) |
Adds a new label to a group of the image by providing name and color. More... | |
void | RenameLabel (LabelValueType labelValue, const std::string &name, const Color &color) |
allows to adapt name and color of a certain label More... | |
void | RemoveLabel (LabelValueType labelValue) |
Removes the label with the given value. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE. More... | |
void | RemoveLabels (const LabelValueVectorType &vectorOfLabelPixelValues) |
Removes labels from the mitk::MultiLabelSegmentation. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE. If a label value does not exist, it will be ignored. More... | |
void | EraseLabel (LabelValueType labelValue) |
Erases the label with the given value from the labelset image. The label itself will not be erased from the respective mitk::LabelSet. In order to remove the label itself use mitk::LabelSetImage::RemoveLabels() More... | |
void | EraseLabels (const LabelValueVectorType &labelValues) |
Erases a list of labels with the given values from the labelset image. More... | |
void | RemoveGroup (GroupIndexType group) |
Removes a whole group including all its labels. More... | |
bool | ExistLabel (LabelValueType value) const |
Returns true if the value exists in the MultiLabelSegmentation instance. More... | |
bool | ExistLabel (LabelValueType value, GroupIndexType groupIndex) const |
Checks if a label belongs in a certain spatial group. More... | |
bool | ExistGroup (GroupIndexType index) const |
Returns true if the spatial group exists in the MultiLabelSegmentation instance. More... | |
GroupIndexType | GetGroupIndexOfLabel (LabelValueType value) const |
mitk::Label::ConstPointer | GetLabel (LabelValueType value) const |
Returns the mitk::Label with the given value. More... | |
mitk::Label::Pointer | GetLabel (LabelValueType value) |
const ConstLabelVectorType | GetLabels () const |
const LabelVectorType | GetLabels () |
const LabelValueVectorType | GetAllLabelValues () const |
const LabelVectorType | GetLabelsByValue (const LabelValueVectorType &labelValues, bool ignoreMissing=true) |
Returns a vector with pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector. More... | |
const ConstLabelVectorType | GetConstLabelsByValue (const LabelValueVectorType &labelValues, bool ignoreMissing=false) const |
Returns a vector with const pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector. For details see GetLabelsByValue();. More... | |
const LabelValueVectorType | GetLabelValuesByGroup (GroupIndexType index) const |
Returns a vector of all label values located on the specified group. More... | |
const LabelValueVectorType | GetLabelValuesByName (GroupIndexType index, const std::string_view name) const |
Returns a vector of all label values located on the specified group having a certain name. More... | |
std::vector< std::string > | GetLabelClassNames () const |
std::vector< std::string > | GetLabelClassNamesByGroup (GroupIndexType index) const |
LabelValueType | GetUnusedLabelValue () const |
virtual bool | GetUnlabeledLabelLock () const |
virtual void | SetUnlabeledLabelLock (bool _arg) |
virtual void | UnlabeledLabelLockOn () |
virtual void | UnlabeledLabelLockOff () |
void | SetAllLabelsVisible (bool visible) |
void | SetAllLabelsVisibleByGroup (GroupIndexType group, bool visible) |
void | SetAllLabelsVisibleByName (GroupIndexType group, const std::string_view name, bool visible) |
bool | IsLabelLocked (LabelValueType value) const |
void | SetAllLabelsLocked (bool locked) |
void | SetAllLabelsLockedByGroup (GroupIndexType group, bool locked) |
void | SetAllLabelsLockedByName (GroupIndexType group, const std::string_view name, bool locked) |
void | ReplaceGroupLabels (const GroupIndexType groupID, const ConstLabelVectorType &newLabels) |
Replaces the labels of a group with a given vector of labels. More... | |
void | ReplaceGroupLabels (const GroupIndexType groupID, const LabelVectorType &newLabels) |
mitk::Image * | GetGroupImage (GroupIndexType groupID) |
const mitk::Image * | GetGroupImage (GroupIndexType groupID) const |
const std::string & | GetGroupName (GroupIndexType groupID) const |
void | SetGroupName (GroupIndexType groupID, const std::string &name) |
itkGetModifiableObjectMacro (LookupTable, mitk::LookupTable) | |
void | SetLookupTable (LookupTable *lut) |
void | UpdateLookupTable (PixelType pixelValue) |
const mitk::Image * | GetGroupImageWorkaround (GroupIndexType groupID) const |
void | UpdateCenterOfMass (PixelType pixelValue) |
More... | |
void | Initialize (const mitk::Image *image) override |
void | ClearBuffer () |
removes all pixel content form the active layer. More... | |
void | MergeLabel (PixelType pixelValue, PixelType sourcePixelValue) |
Merges the mitk::Label with a given target value with the active label. More... | |
void | MergeLabels (PixelType pixelValue, const std::vector< PixelType > &vectorOfSourcePixelValues) |
Merges a list of mitk::Labels with the mitk::Label that has a specific value. More... | |
unsigned int | GetActiveLayer () const |
Gets the ID of the currently active layer. More... | |
Label * | GetActiveLabel () |
const Label * | GetActiveLabel () const |
unsigned int | GetNumberOfLabels (unsigned int layer) const |
Get the number of all existing mitk::Labels for a given layer. More... | |
unsigned int | GetTotalNumberOfLabels () const |
Returns the number of all labels summed up across all layers. More... | |
void | InitializeByLabeledImage (mitk::Image::Pointer image) |
Initialize a new mitk::LabelSetImage by a given image. For all distinct pixel values of the parameter image new labels will be created. If the number of distinct pixel values exceeds mitk::Label::MAX_LABEL_VALUE an exception will be raised. More... | |
void | MaskStamp (mitk::Image *mask, bool forceOverwrite) |
void | SetActiveLayer (unsigned int layer) |
void | SetActiveLabel (LabelValueType label) |
unsigned int | GetNumberOfLayers () const |
GroupIndexType | AddLayer (ConstLabelVector labels={}) |
Adds a new layer to the LabelSetImage. The new layer will be set as the active one. More... | |
GroupIndexType | AddLayer (mitk::Image *layerImage, ConstLabelVector labels={}) |
Adds a layer based on a provided mitk::Image. More... | |
Public Member Functions inherited from mitk::Image | |
virtual std::vector< std::string > | GetClassHierarchy () const override |
virtual const char * | GetClassName () const |
Pointer | Clone () const |
const mitk::PixelType | GetPixelType (int n=0) const |
Returns the PixelType of channel n. More... | |
unsigned int | GetDimension () const |
Get dimension of the image. More... | |
unsigned int | GetDimension (int i) const |
Get the size of dimension i (e.g., i=0 results in the number of pixels in x-direction). More... | |
virtual vtkImageData * | GetVtkImageData (int t=0, int n=0) |
Get a volume at a specific time t of channel n as a vtkImageData. More... | |
virtual const vtkImageData * | GetVtkImageData (int t=0, int n=0) const |
bool | IsSliceSet (int s=0, int t=0, int n=0) const override |
Check whether slice s at time t in channel n is set. More... | |
bool | IsVolumeSet (int t=0, int n=0) const override |
Check whether volume at time t in channel n is set. More... | |
bool | IsChannelSet (int n=0) const override |
Check whether the channel n is set. More... | |
virtual bool | SetSlice (const void *data, int s=0, int t=0, int n=0) |
Set data as slice s at time t in channel n. It is in the responsibility of the caller to ensure that the data vector data is really a slice (at least is not smaller than a slice), since there is no chance to check this. More... | |
virtual bool | SetVolume (const void *data, int t=0, int n=0) |
Set data as volume at time t in channel n. It is in the responsibility of the caller to ensure that the data vector data is really a volume (at least is not smaller than a volume), since there is no chance to check this. More... | |
virtual bool | SetChannel (const void *data, int n=0) |
Set data in channel n. It is in the responsibility of the caller to ensure that the data vector data is really a channel (at least is not smaller than a channel), since there is no chance to check this. More... | |
virtual bool | SetImportSlice (void *data, int s=0, int t=0, int n=0, ImportMemoryManagementType importMemoryManagement=CopyMemory) |
Set data as slice s at time t in channel n. It is in the responsibility of the caller to ensure that the data vector data is really a slice (at least is not smaller than a slice), since there is no chance to check this. More... | |
virtual bool | SetImportVolume (void *data, int t=0, int n=0, ImportMemoryManagementType importMemoryManagement=CopyMemory) |
Set data as volume at time t in channel n. It is in the responsibility of the caller to ensure that the data vector data is really a volume (at least is not smaller than a volume), since there is no chance to check this. More... | |
virtual bool | SetImportVolume (const void *const_data, int t=0, int n=0) |
virtual bool | SetImportChannel (void *data, int n=0, ImportMemoryManagementType importMemoryManagement=CopyMemory) |
Set data in channel n. It is in the responsibility of the caller to ensure that the data vector data is really a channel (at least is not smaller than a channel), since there is no chance to check this. More... | |
virtual void | Initialize (const mitk::PixelType &type, unsigned int dimension, const unsigned int *dimensions, unsigned int channels=1) |
virtual void | Initialize (const mitk::PixelType &type, const mitk::BaseGeometry &geometry, unsigned int channels=1, int tDim=1) |
virtual void | Initialize (const mitk::PixelType &type, const mitk::TimeGeometry &geometry, unsigned int channels=1, int tDim=-1) |
Initialize new (or re-initialize) image information by a TimeGeometry. More... | |
virtual void | Initialize (const mitk::PixelType &type, int sDim, const mitk::PlaneGeometry &geometry2d, unsigned int channels=1, int tDim=1) |
virtual void | Initialize (const mitk::ImageDescriptor::Pointer inDesc) |
virtual void | Initialize (vtkImageData *vtkimagedata, int channels=1, int tDim=-1, int sDim=-1, int pDim=-1) |
template<typename itkImageType > | |
void | InitializeByItk (const itkImageType *itkimage, int channels=1, int tDim=-1, int sDim=-1) |
virtual bool | IsValidSlice (int s=0, int t=0, int n=0) const |
Check whether slice s at time t in channel n is valid, i.e., is (or can be) inside of the image. More... | |
virtual bool | IsValidVolume (int t=0, int n=0) const |
Check whether volume at time t in channel n is valid, i.e., is (or can be) inside of the image. More... | |
virtual bool | IsValidChannel (int n=0) const |
Check whether the channel n is valid, i.e., is (or can be) inside of the image. More... | |
bool | IsRotated () const |
Returns true if an image is rotated, i.e. its geometry's transformation matrix has nonzero elements besides the diagonal. Non-diagonal elements are checked if larger then 1/1000 of the matrix' trace. More... | |
unsigned int * | GetDimensions () const |
Get the sizes of all dimensions as an integer-array. More... | |
ImageDescriptor::Pointer | GetImageDescriptor () const |
ChannelDescriptor | GetChannelDescriptor (int id=0) const |
void | SetGeometry (BaseGeometry *aGeometry3D) override |
Sets a geometry to an image. More... | |
virtual ImageDataItemPointer | GetSliceData (int s=0, int t=0, int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const |
virtual ImageDataItemPointer | GetVolumeData (int t=0, int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const |
virtual ImageDataItemPointer | GetChannelData (int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const |
StatisticsHolderPointer | GetStatistics () const |
Returns a pointer to the ImageStatisticsHolder object that holds all statistics information for the image. More... | |
Public Member Functions inherited from mitk::SlicedData | |
itkStaticConstMacro (RegionDimension, unsigned int, 5) | |
void | UpdateOutputInformation () override |
void | PrepareForNewData () override |
void | SetRequestedRegionToLargestPossibleRegion () override |
bool | RequestedRegionIsOutsideOfTheBufferedRegion () override |
bool | VerifyRequestedRegion () override |
Verify that the RequestedRegion is within the LargestPossibleRegion. More... | |
void | SetRequestedRegion (const itk::DataObject *data) override |
virtual void | SetRequestedRegion (SlicedData::RegionType *region) |
void | SetLargestPossibleRegion (SlicedData::RegionType *region) |
Sets the largest possible region. The largest possible region is the entire region occupied by the data object. Note that the largest possible region should always be bigger then the requested region of a certain operation. More... | |
const RegionType & | GetLargestPossibleRegion () const |
virtual const RegionType & | GetRequestedRegion () const |
void | CopyInformation (const itk::DataObject *data) override |
unsigned int | GetNumberOfChannels () const |
Get the number of channels. More... | |
SlicedGeometry3D * | GetSlicedGeometry (unsigned int t=0) const |
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). More... | |
const SlicedGeometry3D * | GetUpdatedSlicedGeometry (unsigned int t=0) |
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). More... | |
void | SetGeometry (BaseGeometry *aGeometry3D) override |
Set the BaseGeometry of the data, which will be referenced (not copied!). It has to be a sub-class of SlicedGeometry3D. More... | |
void | SetOrigin (const Point3D &origin) override |
Convenience method for setting the origin of the SlicedGeometry3D instances of all time steps. More... | |
virtual void | SetSpacing (const ScalarType aSpacing[]) |
Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps. More... | |
virtual void | SetSpacing (mitk::Vector3D aSpacing) |
Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps. More... | |
Public Member Functions inherited from mitk::BaseData | |
BaseProperty::ConstPointer | GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override |
Get property by its key. More... | |
std::vector< std::string > | GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override |
Query keys of existing properties. More... | |
std::vector< std::string > | GetPropertyContextNames () const override |
Query names of existing contexts. More... | |
BaseProperty * | GetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override |
Get property by its key. More... | |
void | SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override |
Add new or change existent property. More... | |
void | RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override |
Removes a property. If the property does not exist, nothing will be done. More... | |
const mitk::TimeGeometry * | GetTimeGeometry () const |
Return the TimeGeometry of the data as const pointer. More... | |
mitk::TimeGeometry * | GetTimeGeometry () |
Return the TimeGeometry of the data as pointer. More... | |
const mitk::TimeGeometry * | GetUpdatedTimeGeometry () |
Return the TimeGeometry of the data. More... | |
const mitk::BaseGeometry * | GetUpdatedGeometry (int t=0) |
Return the BaseGeometry of the data at time t. More... | |
mitk::BaseGeometry * | GetGeometry (int t=0) const |
Return the geometry, which is a TimeGeometry, of the data as non-const pointer. More... | |
void | UpdateOutputInformation () override |
Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess. More... | |
void | CopyInformation (const itk::DataObject *data) override |
Copy information from the specified data set. More... | |
virtual bool | IsInitialized () const |
Check whether the data has been initialized, i.e., at least the Geometry and other header data has been set. More... | |
virtual bool | IsEmptyTimeStep (unsigned int t) const |
Check whether object contains data (at a specified time), e.g., a set of points may be empty. More... | |
virtual bool | IsEmpty () const |
Check whether object contains data (at least at one point in time), e.g., a set of points may be empty. More... | |
void | ExecuteOperation (Operation *operation) override |
overwrite if the Data can be called by an Interactor (StateMachine). More... | |
virtual void | SetTimeGeometry (TimeGeometry *geometry) |
Set the TimeGeometry of the data, which will be referenced (not copied!). More... | |
virtual void | SetClonedGeometry (const BaseGeometry *aGeometry3D) |
Set a clone of the provided Geometry as Geometry of the data. Assumes the data object has only 1 time step ( is a 3D object ) and creates a new TimeGeometry. If an TimeGeometry has already been set for the object, it will be replaced after calling this function. More... | |
virtual void | SetClonedTimeGeometry (const TimeGeometry *geometry) |
Set a clone of the provided TimeGeometry as TimeGeometry of the data. More... | |
virtual void | SetClonedGeometry (const BaseGeometry *aGeometry3D, unsigned int time) |
Set a clone of the provided geometry as BaseGeometry of a given time step. More... | |
mitk::PropertyList::Pointer | GetPropertyList () const |
Get the data's property list. More... | |
void | SetPropertyList (PropertyList *propertyList) |
Set the data's property list. More... | |
mitk::BaseProperty::Pointer | GetProperty (const char *propertyKey) const |
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;. More... | |
void | SetProperty (const char *propertyKey, BaseProperty *property) |
itk::SmartPointer< mitk::BaseDataSource > | GetSource () const |
Get the process object that generated this data object. More... | |
unsigned int | GetTimeSteps () const |
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by itself, the number of time steps is defined over the time sliced geometry. In sub classes, a better implementation could be over the length of the data vector. More... | |
itk::ModifiedTimeType | GetMTime () const override |
Get the modified time of the last change of the contents this data object or its geometry. More... | |
void | Graft (const DataObject *) override |
Public Member Functions inherited from mitk::OperationActor | |
itkTypeMacroNoParent (OperationActor) virtual ~OperationActor() | |
Public Member Functions inherited from mitk::Identifiable | |
Identifiable () | |
Identifiable (const UIDType &uid) | |
Identifiable (const Identifiable &)=delete | |
Identifiable (Identifiable &&) noexcept | |
virtual | ~Identifiable () |
Identifiable & | operator= (const Identifiable &)=delete |
Identifiable & | operator= (Identifiable &&other) noexcept |
virtual UIDType | GetUID () const |
Get unique ID of an object. More... | |
Public Member Functions inherited from mitk::IPropertyOwner | |
~IPropertyOwner () override | |
Public Member Functions inherited from mitk::IPropertyProvider | |
virtual | ~IPropertyProvider () |
Static Public Member Functions | |
static Pointer | New () |
static LabelValueVectorType | ExtractLabelValuesFromLabelVector (const ConstLabelVectorType &labels) |
static LabelValueVectorType | ExtractLabelValuesFromLabelVector (const LabelVectorType &labels) |
static ConstLabelVectorType | ConvertLabelVectorConst (const LabelVectorType &labels) |
Static Public Member Functions inherited from mitk::Image | |
static const char * | GetStaticNameOfClass () |
static Pointer | New () |
Static Public Member Functions inherited from mitk::SlicedData | |
static const char * | GetStaticNameOfClass () |
Static Public Member Functions inherited from mitk::BaseData | |
static const char * | GetStaticNameOfClass () |
Public Attributes | |
Message | BeforeChangeLayerEvent |
BeforeChangeLayerEvent (e.g. used for GUI integration) As soon as active labelset should be changed, the signal emits. Emitted by SetActiveLayer(int layer);. More... | |
Message | AfterChangeLayerEvent |
AfterchangeLayerEvent (e.g. used for GUI integration) As soon as active labelset was changed, the signal emits. Emitted by SetActiveLayer(int layer);. More... | |
Static Public Attributes | |
const static LabelValueType | UNLABELED_VALUE |
Protected Member Functions | |
void | OnLabelModified (const Object *sender, const itk::EventObject &) |
void | AddLabelToMap (LabelValueType labelValue, Label *label, GroupIndexType groupID) |
void | RemoveLabelFromMap (LabelValueType labelValue) |
void | RegisterLabel (Label *label) |
void | ReleaseLabel (Label *label) |
void | ApplyToLabels (const LabelValueVectorType &values, std::function< void(Label *)> &&lambda) |
void | VisitLabels (const LabelValueVectorType &values, std::function< void(const Label *)> &&lambda) const |
mitkCloneMacro (Self) | |
LabelSetImage () | |
LabelSetImage (const LabelSetImage &other) | |
~LabelSetImage () override | |
template<typename TPixel , unsigned int VImageDimension> | |
void | LayerContainerToImageProcessing (itk::Image< TPixel, VImageDimension > *source, unsigned int layer) |
template<typename TPixel , unsigned int VImageDimension> | |
void | ImageToLayerContainerProcessing (const itk::Image< TPixel, VImageDimension > *source, unsigned int layer) const |
template<typename ImageType > | |
void | CalculateCenterOfMassProcessing (ImageType *input, LabelValueType index) |
template<typename ImageType > | |
void | EraseLabelProcessing (ImageType *input, PixelType index) |
template<typename ImageType > | |
void | MergeLabelProcessing (ImageType *input, PixelType pixelValue, PixelType index) |
template<typename ImageType > | |
void | MaskStampProcessing (ImageType *input, mitk::Image *mask, bool forceOverwrite) |
template<typename LabelSetImageType , typename ImageType > | |
void | InitializeByLabeledImageProcessing (LabelSetImageType *input, ImageType *other) |
LabelValueVectorType | GetUsedLabelValues () const |
Protected Member Functions inherited from mitk::Image | |
virtual itk::LightObject::Pointer | InternalClone () const override |
int | GetSliceIndex (int s=0, int t=0, int n=0) const |
int | GetVolumeIndex (int t=0, int n=0) const |
void | ComputeOffsetTable () |
virtual bool | IsValidTimeStep (int t) const |
void | Expand (unsigned int timeSteps) override |
Expands the TimeGeometry to a number of TimeSteps. More... | |
virtual ImageDataItemPointer | AllocateSliceData (int s=0, int t=0, int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const |
virtual ImageDataItemPointer | AllocateVolumeData (int t=0, int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const |
virtual ImageDataItemPointer | AllocateChannelData (int n=0, void *data=nullptr, ImportMemoryManagementType importMemoryManagement=CopyMemory) const |
Image () | |
Image (const Image &other) | |
~Image () override | |
void | Clear () override |
Calls ClearData() and InitializeEmpty();. More... | |
void | Initialize () override |
void | PrintSelf (std::ostream &os, itk::Indent indent) const override |
Protected Member Functions inherited from mitk::SlicedData | |
SlicedData () | |
SlicedData (const SlicedData &other) | |
~SlicedData () override | |
Protected Member Functions inherited from mitk::BaseData | |
BaseData () | |
BaseData (const BaseData &other) | |
~BaseData () override | |
virtual void | InitializeTimeGeometry (unsigned int timeSteps=1) |
Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and evenly timed. In many cases it will be necessary to overwrite this in sub-classes. More... | |
virtual void | ClearData () |
reset to non-initialized state, release memory More... | |
virtual void | InitializeEmpty () |
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeGeometry() to ensure an existing valid geometry. More... | |
void | PrintSelf (std::ostream &os, itk::Indent indent) const override |
Protected Member Functions inherited from mitk::Identifiable | |
virtual void | SetUID (const UIDType &uid) |
Protected Attributes | |
LabelValueType | m_ActiveLabelValue |
std::vector< Image::Pointer > | m_LayerContainer |
int | m_ActiveLayer |
bool | m_activeLayerInvalid |
Protected Attributes inherited from mitk::Image | |
ImageDataItemPointerArray | m_Channels |
ImageDataItemPointerArray | m_Volumes |
ImageDataItemPointerArray | m_Slices |
std::mutex | m_ImageDataArraysLock |
unsigned int | m_Dimension |
unsigned int * | m_Dimensions |
ImageDescriptor::Pointer | m_ImageDescriptor |
size_t * | m_OffsetTable |
ImageDataItemPointer | m_CompleteData |
StatisticsHolderPointer | m_ImageStatistics |
Protected Attributes inherited from mitk::SlicedData | |
RegionType | m_LargestPossibleRegion |
RegionType | m_RequestedRegion |
bool | m_RequestedRegionInitialized |
RegionType | m_BufferedRegion |
bool | m_UseLargestPossibleRegion |
Protected Attributes inherited from mitk::BaseData | |
bool | m_LastRequestedRegionWasOutsideOfTheBufferedRegion |
unsigned int | m_SourceOutputIndexDuplicate |
bool | m_Initialized |
Additional Inherited Members | |
Protected Types inherited from mitk::Image | |
typedef std::lock_guard< std::mutex > | MutexHolder |
LabelSetImage class for handling labels and layers in a segmentation session.
Events that are potentially send by the class in regard to groups or labels:
Definition at line 43 of file mitkLabelSetImage.h.
Definition at line 76 of file mitkLabelSetImage.h.
using mitk::LabelSetImage::GroupIndexType = std::size_t |
Definition at line 74 of file mitkLabelSetImage.h.
Definition at line 75 of file mitkLabelSetImage.h.
using mitk::LabelSetImage::LabelValueVectorType = std::vector<LabelValueType> |
Definition at line 78 of file mitkLabelSetImage.h.
Definition at line 77 of file mitkLabelSetImage.h.
Definition at line 70 of file mitkLabelSetImage.h.
|
protected |
|
protected |
|
overrideprotected |
mitk::Label* mitk::LabelSetImage::AddLabel | ( | const std::string & | name, |
const Color & | color, | ||
GroupIndexType | groupID | ||
) |
Adds a new label to a group of the image by providing name and color.
name | (Class) name of the label instance that should be added. |
color | Color of the new label instance. |
groupID | The id of the group the label should be added to. |
mitk::Label* mitk::LabelSetImage::AddLabel | ( | Label * | label, |
GroupIndexType | groupID, | ||
bool | addAsClone = true , |
||
bool | correctLabelValue = true |
||
) |
Adds a label instance to a group of the multi label image.
label | Instance of an label that should be added or used as template |
groupID | The id of the group the label should be added to. |
addAsClone | Flag that controls, if the passed instance should be added (false; the image will then take ownership, be aware that e.g. event observers will be added) a clone of the instance (true). |
correctLabelValue | Flag that controls, if the value of the passed label should be correct, if this value is already used in the multi label image. True: Conflicting values will be corrected, be assigning a none conflicting value. False: If the value is conflicting an exception will be thrown. |
|
protected |
Helper to ensure that the maps are correctly populated for a new label instance.
mitk::Label* mitk::LabelSetImage::AddLabelWithContent | ( | Label * | label, |
const Image * | labelContent, | ||
GroupIndexType | groupID, | ||
LabelValueType | contentLabelValue, | ||
bool | addAsClone = true , |
||
bool | correctLabelValue = true |
||
) |
Adds a label instance to a group of the multi label image including its pixel content.
label | Instance of a label that should be added or used as template |
groupID | The id of the group the label should be added to. |
labelContent | Pointer to an image that contains the pixel content of the label that should be added. |
contentLabelValue | Pixel value in the content image that indicates the label (may not be the same like the label value used in the segmentation after addition). |
addAsClone | Flag that controls, if the passed instance should be added (false; the image will then take ownership, be aware that e.g. event observers will be added) a clone of the instance (true). |
correctLabelValue | Flag that controls, if the value of the passed label should be corrected, if this value is already used in the multi label image. True: Conflicting values will be corrected, by assigning a none conflicting value. False: If the value is conflicting an exception will be thrown. |
GroupIndexType mitk::LabelSetImage::AddLayer | ( | ConstLabelVector | labels = {} | ) |
Adds a new layer to the LabelSetImage. The new layer will be set as the active one.
labels | Labels that will be added to the new layer if provided |
GroupIndexType mitk::LabelSetImage::AddLayer | ( | mitk::Image * | layerImage, |
ConstLabelVector | labels = {} |
||
) |
Adds a layer based on a provided mitk::Image.
layerImage | is added to the vector of label images |
labels | labels that will be cloned and added to the new layer if provided |
|
protected |
Helper class used internally to apply lambda functions to the labels specified by the passed label value vector.
|
protected |
void mitk::LabelSetImage::ClearBuffer | ( | ) |
removes all pixel content form the active layer.
|
static |
Helper function that converts a given vector of label instance pointers into a vector of const pointers.
void mitk::LabelSetImage::EraseLabel | ( | LabelValueType | labelValue | ) |
Erases the label with the given value from the labelset image. The label itself will not be erased from the respective mitk::LabelSet. In order to remove the label itself use mitk::LabelSetImage::RemoveLabels()
labelValue | the pixel value of the label that will be erased from the labelset image |
|
protected |
void mitk::LabelSetImage::EraseLabels | ( | const LabelValueVectorType & | labelValues | ) |
Erases a list of labels with the given values from the labelset image.
labelValues | the list of pixel values of the labels that will be erased from the labelset image |
bool mitk::LabelSetImage::ExistGroup | ( | GroupIndexType | index | ) | const |
Returns true if the spatial group exists in the MultiLabelSegmentation instance.
index | Group index of the group that should be checked for existence. |
bool mitk::LabelSetImage::ExistLabel | ( | LabelValueType | value | ) | const |
Returns true if the value exists in the MultiLabelSegmentation instance.
bool mitk::LabelSetImage::ExistLabel | ( | LabelValueType | value, |
GroupIndexType | groupIndex | ||
) | const |
Checks if a label belongs in a certain spatial group.
value | the label value |
groupIndex | Index of the spatial group which should be checked for the label |
|
static |
Helper function that can be used to extract a vector of label values of a vector of label instance pointers.
|
static |
Helper function that can be used to extract a vector of label values are vector of label instances.
Label* mitk::LabelSetImage::GetActiveLabel | ( | ) |
const Label* mitk::LabelSetImage::GetActiveLabel | ( | ) | const |
unsigned int mitk::LabelSetImage::GetActiveLayer | ( | ) | const |
Gets the ID of the currently active layer.
const LabelValueVectorType mitk::LabelSetImage::GetAllLabelValues | ( | ) | const |
Returns a vector of all label values currently defined in the MultiLabelSegmentation instance.
const ConstLabelVectorType mitk::LabelSetImage::GetConstLabelsByValue | ( | const LabelValueVectorType & | labelValues, |
bool | ignoreMissing = false |
||
) | const |
Returns a vector with const pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector. For details see GetLabelsByValue();.
mitk::Image* mitk::LabelSetImage::GetGroupImage | ( | GroupIndexType | groupID | ) |
Returns the pointer to the image that contains the labeling of the indicate group.
const mitk::Image* mitk::LabelSetImage::GetGroupImage | ( | GroupIndexType | groupID | ) | const |
Returns the pointer to the image that contains the labeling of the indicate group.
const mitk::Image* mitk::LabelSetImage::GetGroupImageWorkaround | ( | GroupIndexType | groupID | ) | const |
DON'T USE. WORKAROUND method that is used until the rework is finished to ensure always getting a group image and not this.
GroupIndexType mitk::LabelSetImage::GetGroupIndexOfLabel | ( | LabelValueType | value | ) | const |
Returns the group id of the based label value.
const std::string& mitk::LabelSetImage::GetGroupName | ( | GroupIndexType | groupID | ) | const |
Returns the name of the indicated group. String may be empty if no name was defined. Remark: The name neither is guaranteed to be defined nor that it is unique. Use the index to uniquely refer to a group.
mitk::Label::Pointer mitk::LabelSetImage::GetLabel | ( | LabelValueType | value | ) |
mitk::Label::ConstPointer mitk::LabelSetImage::GetLabel | ( | LabelValueType | value | ) | const |
Returns the mitk::Label with the given value.
value | the pixel value of the label |
std::vector<std::string> mitk::LabelSetImage::GetLabelClassNames | ( | ) | const |
Returns a vector with (class) names of all label instances used in the segmentation (over all groups)
std::vector<std::string> mitk::LabelSetImage::GetLabelClassNamesByGroup | ( | GroupIndexType | index | ) | const |
Returns a vector with (class) names of all label instances present in a certain group.
index | ID of the group, for which the label class names should be returned |
const LabelVectorType mitk::LabelSetImage::GetLabels | ( | ) |
const ConstLabelVectorType mitk::LabelSetImage::GetLabels | ( | ) | const |
Returns a vector with pointers to all labels currently defined in the MultiLabelSegmentation instance.
const LabelVectorType mitk::LabelSetImage::GetLabelsByValue | ( | const LabelValueVectorType & | labelValues, |
bool | ignoreMissing = true |
||
) |
Returns a vector with pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector.
labelValues | Vector of values of labels that should be returned. |
ignoreMissing | If true (default), unknown labels Will be skipped in the result. If false, an exception will be raised, if a label is requested. |
const LabelValueVectorType mitk::LabelSetImage::GetLabelValuesByGroup | ( | GroupIndexType | index | ) | const |
Returns a vector of all label values located on the specified group.
index | the index of the group for which the vector of labels should be retrieved. If an invalid index is passed an exception will be raised. |
const LabelValueVectorType mitk::LabelSetImage::GetLabelValuesByName | ( | GroupIndexType | index, |
const std::string_view | name | ||
) | const |
Returns a vector of all label values located on the specified group having a certain name.
index | the index of the group for which the vector of labels should be retrieved. If an invalid index is passed an exception will be raised. |
name | Name of the label instances one is looking for. |
unsigned int mitk::LabelSetImage::GetNumberOfLabels | ( | unsigned int | layer | ) | const |
Get the number of all existing mitk::Labels for a given layer.
layer | the layer ID for which the active mitk::Labels should be retrieved |
unsigned int mitk::LabelSetImage::GetNumberOfLayers | ( | ) | const |
unsigned int mitk::LabelSetImage::GetTotalNumberOfLabels | ( | ) | const |
Returns the number of all labels summed up across all layers.
|
virtual |
LabelValueType mitk::LabelSetImage::GetUnusedLabelValue | ( | ) | const |
Helper that returns an unused label value, that could be used e.g. if one wants to define a label externally before adding it.
|
protected |
helper needed for ensuring unique values. returns a sorted list of all labels (including the value for Unlabeled pixels..
|
protected |
|
overridevirtual |
initialize new (or re-initialize) image information by another mitk-image. Only the header is used, not the data vector!
Reimplemented from mitk::Image.
void mitk::LabelSetImage::InitializeByLabeledImage | ( | mitk::Image::Pointer | image | ) |
Initialize a new mitk::LabelSetImage by a given image. For all distinct pixel values of the parameter image new labels will be created. If the number of distinct pixel values exceeds mitk::Label::MAX_LABEL_VALUE an exception will be raised.
image | the image which is used for initialization |
|
protected |
bool mitk::LabelSetImage::IsLabelLocked | ( | LabelValueType | value | ) | const |
Returns the lock state of the label (including UnlabeledLabel value).
mitk::LabelSetImage::itkGetModifiableObjectMacro | ( | LookupTable | , |
mitk::LookupTable | |||
) |
|
protected |
void mitk::LabelSetImage::MaskStamp | ( | mitk::Image * | mask, |
bool | forceOverwrite | ||
) |
|
protected |
Merges the mitk::Label with a given target value with the active label.
pixelValue | the value of the label that should be the new merged label |
sourcePixelValue | the value of the label that should be merged into the specified one |
|
protected |
void mitk::LabelSetImage::MergeLabels | ( | PixelType | pixelValue, |
const std::vector< PixelType > & | vectorOfSourcePixelValues | ||
) |
Merges a list of mitk::Labels with the mitk::Label that has a specific value.
pixelValue | the value of the label that should be the new merged label |
vectorOfSourcePixelValues | the list of label values that should be merge into the specified one |
mitk::LabelSetImage::mitkClassMacro | ( | LabelSetImage | , |
Image | |||
) |
|
protected |
|
static |
|
protected |
|
protected |
Helper to ensure label events are correctly connected and lookup table is updated for a new label instance.
|
protected |
Helper to ensure label events are unregistered.
void mitk::LabelSetImage::RemoveGroup | ( | GroupIndexType | group | ) |
Removes a whole group including all its labels.
group | Group index of the spatial group that should be removed. If the spatial group does not exist, an exception will be raised. |
void mitk::LabelSetImage::RemoveLabel | ( | LabelValueType | labelValue | ) |
Removes the label with the given value. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE.
labelValue | the pixel value of the label to be removed. If the label is unknown, the method will return without doing anything. |
|
protected |
void mitk::LabelSetImage::RemoveLabels | ( | const LabelValueVectorType & | vectorOfLabelPixelValues | ) |
Removes labels from the mitk::MultiLabelSegmentation. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE. If a label value does not exist, it will be ignored.
vectorOfLabelPixelValues | a list of labels to be removed |
void mitk::LabelSetImage::RenameLabel | ( | LabelValueType | labelValue, |
const std::string & | name, | ||
const Color & | color | ||
) |
allows to adapt name and color of a certain label
labelValue | Value of the label that should be changed |
name | New name for the label |
color | New color for the label |
void mitk::LabelSetImage::ReplaceGroupLabels | ( | const GroupIndexType | groupID, |
const ConstLabelVectorType & | newLabels | ||
) |
Replaces the labels of a group with a given vector of labels.
groupID | The index of the group that should have its labels replaced |
newLabels | The vector of new labels |
void mitk::LabelSetImage::ReplaceGroupLabels | ( | const GroupIndexType | groupID, |
const LabelVectorType & | newLabels | ||
) |
void mitk::LabelSetImage::SetActiveLabel | ( | LabelValueType | label | ) |
void mitk::LabelSetImage::SetActiveLayer | ( | unsigned int | layer | ) |
void mitk::LabelSetImage::SetAllLabelsLocked | ( | bool | locked | ) |
Set the lock state of all label instances accordingly to the passed state.
void mitk::LabelSetImage::SetAllLabelsLockedByGroup | ( | GroupIndexType | group, |
bool | locked | ||
) |
Set the lock state of all label instances in a group accordingly to the passed state.
void mitk::LabelSetImage::SetAllLabelsLockedByName | ( | GroupIndexType | group, |
const std::string_view | name, | ||
bool | locked | ||
) |
Set the lock state of all label instances In a group with a given class name accordingly to the passed state.
void mitk::LabelSetImage::SetAllLabelsVisible | ( | bool | visible | ) |
Set the visibility of all label instances accordingly to the passed state.
void mitk::LabelSetImage::SetAllLabelsVisibleByGroup | ( | GroupIndexType | group, |
bool | visible | ||
) |
Set the visibility of all label instances in a group accordingly to the passed state.
void mitk::LabelSetImage::SetAllLabelsVisibleByName | ( | GroupIndexType | group, |
const std::string_view | name, | ||
bool | visible | ||
) |
Set the visibility of all label instances In a group with a given class name accordingly to the passed state.
void mitk::LabelSetImage::SetGroupName | ( | GroupIndexType | groupID, |
const std::string & | name | ||
) |
Set the name of a group.
void mitk::LabelSetImage::SetLookupTable | ( | LookupTable * | lut | ) |
|
virtual |
|
virtual |
|
virtual |
void mitk::LabelSetImage::UpdateCenterOfMass | ( | PixelType | pixelValue | ) |
void mitk::LabelSetImage::UpdateLookupTable | ( | PixelType | pixelValue | ) |
Updates the lookup table for a label indicated by the passed label value using the color of the label.
|
protected |
Helper class used internally to for visiting the labels specified by the passed label value vector with the lambda function.
Message mitk::LabelSetImage::AfterChangeLayerEvent |
AfterchangeLayerEvent (e.g. used for GUI integration) As soon as active labelset was changed, the signal emits. Emitted by SetActiveLayer(int layer);.
Definition at line 58 of file mitkLabelSetImage.h.
Message mitk::LabelSetImage::BeforeChangeLayerEvent |
BeforeChangeLayerEvent (e.g. used for GUI integration) As soon as active labelset should be changed, the signal emits. Emitted by SetActiveLayer(int layer);.
Definition at line 51 of file mitkLabelSetImage.h.
|
protected |
Definition at line 385 of file mitkLabelSetImage.h.
|
protected |
Definition at line 554 of file mitkLabelSetImage.h.
|
protected |
Definition at line 555 of file mitkLabelSetImage.h.
|
protected |
Definition at line 552 of file mitkLabelSetImage.h.
|
static |
Definition at line 80 of file mitkLabelSetImage.h.