![]() |
ImFusion C++ SDK 4.4.0
|
#include <ImFusionLabels/lib/include/ImFusion/Labels/ML/LabelsProjectDataReader.h>
Data loader for training pipelines that load data directly from a Labels project. More...
Data loader for training pipelines that load data directly from a Labels project.
Supports both local and remote ImFusion Labels projects. For remote projects, an access token is required.
The DataItems generated by this loader consist of DataElements that contain the image data (default key 'images', can be changed using the data_name entry) and DataElements from one or more segmentation/keypoint/boundingbox layers (key is the layer name from Labels unless a specific name is defined using the field_name entry). A user defined filter can be used to limit the results to a subset of the datasets in the project.
Validation and Error Handling:
Label Mapping Behavior:
Sample usage in an IMT training yaml:
sources: {} pipeline:
layers: # define which layers to load yourSegmentLayer: field_name: heart # We can define the field name of the data element (default is the layer name) Heart: 1 # define mapping from labelname to value, required for all layers yourKeypointLayer: # keypoints are supported ventricle: 1 filter: # filter defines which datasets are selected MyBooleanTag: true MyFloatTag: "<10" MyEnumTag: "Blue Red" # space seperated string match: any # keyword for match mode, other option: all invert: false # keyword for filter inversion (like in ImFusionLabels) shuffle: true # internal shuffle is supported crop_to_roi: true # crop images and labels to ROI (default false) data_name: data # default 'images'
Public Member Functions | |
| LabelsProjectDataReader (std::string projectPath, bool shuffle=false, bool verbose=false) | |
| LabelsProjectDataReader (const Properties &properties) | |
| constructor for DataLoaderDecoratorFactory | |
| std::optional< DataItem > | next () final |
| Advance the loader by one iteration. | |
| std::optional< size_t > | size () const final |
| Size of the loader, has value only for fixed cardinalities. | |
| void | reset () final |
| Reset the loader in order to restart the iteration. | |
| Public Member Functions inherited from ImFusion::ML::DataReader | |
| DataReader (std::string name="", bool verbose=false) | |
| Cardinality | cardinality () const override |
| Readers have fixed cardinality. | |
| Public Member Functions inherited from ImFusion::ML::DataLoader | |
| DataLoader (std::string name, bool verbose=false) | |
| Constructor to be used by DataReaders, as they are the first elements in the chain. | |
| DataLoader (std::string name, std::unique_ptr< DataLoader > loader, bool verbose=false) | |
| Constructor to be used by all other derived DataLoaders. | |
| DataLoader (std::string name, DataLoaderList &&dataLoaders, bool verbose=false) | |
| Constructor to be used by all other derived DataLoaders. | |
| const std::string & | name () const |
| Name of the loader. | |
| virtual void | reinit () |
| Reinitialize the loader state, cleaning it up if necessary Overload this method if your loader has state that must survive reset (i.e. | |
| DataLoader * | singleUnderlyingLoader () const |
| Return a single underlying dataloader Expects there to be only one, returns a nullptr otherwise. | |
| std::unique_ptr< DataLoader > | extractDataloader () |
| Return a single underlying dataloader Expects there to be only one, throws an exception otherwise. | |
| DataLoaderList & | loaders () |
| DataLoaderList const & | loaders () const |
| bool | verbose () const |
| virtual void | setRandomSeed (unsigned int seed) |
| virtual Status | canBePrefetched () const |
| Indicates whether a loader is eligible for prefetching. | |
| const std::string & | logDomain () const |
| Log domain for AdvancedParameter. | |
| Public Member Functions inherited from ImFusion::Configurable | |
| virtual void | configuration (Properties *p) const |
| Serialize the current object configuration into the given Properties object. | |
| virtual void | configureDefaults () |
| Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
| void | registerParameter (ParameterBase *param) |
| Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
| void | unregisterParameter (const ParameterBase *param) |
| Remove the given Parameter or SubProperty from the list of registered parameters. | |
| Configurable (const Configurable &rhs) | |
| Configurable (Configurable &&rhs) noexcept | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Public Attributes | |
| LoaderParam< std::string > | p_projectPath = {"path", "", this, ParamRequired::Yes} |
| LoaderParam< std::string > | p_accessToken = {"access_token", "", this, ParamRequired::No} |
| Access token for remote projects. Required when path points to a remote project (http/https URL). | |
| LoaderParam< bool > | p_shuffle = {"shuffle", false, this, ParamRequired::No} |
| LoaderParam< std::string > | p_dataName = {"data_name", "images", this, ParamRequired::No} |
| LoaderParam< bool > | p_cropToROI = {"crop_to_roi", false, this, ParamRequired::No} |
| Whether to crop images and labels to the region of interest (ROI) defined in the dataset descriptor. | |
| LoaderParam< bool > | p_internallyUpdateProject = {"internally_update_project", false, this, ParamRequired::No} |
| Whether to load labels projects with an old labels version. This may result in files being written to disk, use at your own risk. | |
| Public Attributes inherited from ImFusion::ML::DataLoader | |
| LoaderParam< bool > | m_verbose = {"verbose", false, this, ParamRequired::No} |
| If enabled, print log messages with extra information like timings. | |
| Public Attributes inherited from ImFusion::Configurable | |
| Signal | signalParametersChanged |
| Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Additional Inherited Members | |
| Protected Member Functions inherited from ImFusion::Utils::NotCopyable | |
| NotCopyable (NotCopyable &&) noexcept=default | |
| NotCopyable & | operator= (NotCopyable &&) noexcept=default |
| NotCopyable (const NotCopyable &)=delete | |
| NotCopyable & | operator= (const NotCopyable &)=delete |
| Protected Attributes inherited from ImFusion::ML::DataLoader | |
| std::string | m_name |
| Cardinality | m_cardinality = Cardinality::Fixed |
| Random::Generator | m_randGenerator |
| DataLoaderList | m_dataLoaders |
| Protected Attributes inherited from ImFusion::Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
finalvirtual |
Advance the loader by one iteration.
The function must pull an item from the underlying node, process it and return it. If the underlyng loader is exhausted, returns an empty optional.
Implements ImFusion::ML::DataLoader.
|
finalvirtual |
Size of the loader, has value only for fixed cardinalities.
Implements ImFusion::ML::DataLoader.
|
finalvirtual |
Reset the loader in order to restart the iteration.
Reimplemented from ImFusion::ML::DataLoader.