ImFusion C++ SDK 4.4.0
ImFusion::Project Class Reference
Inheritance diagram for ImFusion::Project:

Classes

struct  Settings
struct  SettingsUpdate
class  TypeSpecificData
struct  PixelwiseLabelType
struct  GeometricAnnotationType
struct  Permissions
 Permissions a user has regarding a project. More...
struct  ImportResult
struct  ProjectImportResult

Public Types

enum  ProjectType { NoProjectType = 0 , PixelwiseProject = 1 << 0 , ImagewiseProject = 1 << 1 , GeometricAnnotationsProject = 1 << 4 }
enum class  DataType {
  InvalidDataType = 0 , SingleChannelImages = 1 << 0 , MultiChannelImages = 1 << 1 , SingleChannelVolumes = 1 << 2 ,
  MultiChannelVolumes = 1 << 3 , AnyDataType = SingleChannelImages | MultiChannelImages | SingleChannelVolumes | MultiChannelVolumes
}
enum  Version {
  V0 = 0 , V1 , V2 , V3 ,
  V4 , V5 , V6 , V7 ,
  V8 , V9 , V10 , V11 ,
  V12 , V13 , V14 , V15 ,
  V16 , V17 , V18 , V19 ,
  V20 , V21 , VERSION_COUNT
}
enum class  LayersToModify { All , CurrentOnly }
enum  ImportProjectOption {
  ImportNewOnes = 1 << 0 , ForceCopy = 1 << 1 , UpdateExisting = 1 << 2 , CopyLabelData = 1 << 3 ,
  CopyTags = 1 << 4
}
enum  LoadStatus { OK = 0 , INTERRUPTED , NOT_FOUND , NOT_COMPATIBLE }
enum class  FailureAction { Discard , Retry , Export }
using ProjectTypes = Flags<ProjectType>
using DataTypes = Flags<DataType>
using PixelwiseData = TypeSpecificData<PixelwiseLabelType>
using GeometricAnnotationData = TypeSpecificData<GeometricAnnotationType>
using TypeMapping = std::vector<std::optional<size_t>>
using WarningMessage = std::string
using FailureActionAndPath = std::tuple<FailureAction, std::string>
 The additional path to a folder is only used together with Export.

Public Member Functions

 Project (const Project &)=delete
Project & operator= (const Project &)=delete
Utils::Expected< std::pair< std::unique_ptr< Project >, WarningMessage >, std::stringcopyToRemote (const Filesystem::Url &remoteUrl, const std::set< QString > &descriptorIdsToCopy={}, Progress *progress=nullptr) const
 Copies the current local project to the remote server \remoteUrl URL of the remote labels server \descriptorIdsToCopy set of descriptor ids to copy (default empty - all descriptors are copied).
std::string addDescriptor (std::unique_ptr< DataDescriptor > desc, const SharedImageSet *image=nullptr, Progress *progress=nullptr)
ImportResult import (const std::vector< Import::Entry > &entries, bool copyData, LayersToModify layersToModify, Progress *progress)
 Imports the given entries to the project.
bool importLayers (std::vector< SharedImageSet * > layers, LayersToModify layersToModify, Progress *progress=nullptr)
ProjectImportResult importDescriptorsFromProject (const Project &p, Flags< ImportProjectOption > flags, bool dryRun, Progress *progress=nullptr)
bool deleteDescriptors (const std::vector< DataDescriptor * > &descs)
void setCurrentDataSet (std::unique_ptr< DataSet > data)
Utils::Expected< DataSet *, std::stringloadDataSet (DataDescriptor &desc, Progress *progress)
bool unloadCurrentDataSet (Progress *progress)
std::unique_ptr< DataSettakeCurrentDataSet ()
void switchDataSetWithProgress (DataDescriptor &desc, QWidget *parent)
 Switches to another dataset.
void setFailureCallback (std::function< FailureActionAndPath(std::string)> callback)
 Set a callback for failures that require some action from the user.
std::function< FailureActionAndPath(std::string)> failureCallback () const
void generateMissingThumbnails (Progress *progress=nullptr) const
const QString & name () const
const QString & projectPath () const
int projectId () const
 Returns the id of the remote project or -1 for local projects.
ProjectTypes projectType () const
DataTypes dataType () const
const QString & enabledActions () const
const std::vector< TagType > & tagTypes () const
const std::set< ResourceLocationallowedResourceLocations () const
const std::vector< Filesystem::UrlallowedResourceUrls () const
const std::vector< std::unique_ptr< DataDescriptor > > & dataDescriptors () const
DataDescriptorfindDescriptorFromID (const QString &identifier) const
DataSetcurrentData () const
Experimentsexperiments ()
bool applySettingsChange (const SettingsUpdate &update)
TagSystemtagSystem ()
const TagSystemtagSystem () const
bool isReadOnly () const
bool isLocal () const
bool isDummy () const
bool isRemote () const
bool supportsDataLinkAndCopy () const
bool supportsExperiments () const
const Permissionspermissions () const
 Permissions of the current user for this project.
const std::stringserverVersion () const
 Version number of the remote server or empty string for local projects.
bool allowsData2D () const
bool allowsData3D () const
bool allowsDataSingleChannel () const
bool allowsDataMultiChannel () const
bool isDatasetCompatible (const ImageMetadata &meta) const
DatasetLicenseSystemdatasetLicenses ()
const DatasetLicenseSystemdatasetLicenses () const
bool applyNewLayers (ProjectTypes newProjectType, std::vector< std::unique_ptr< PixelwiseData > > pixelwiseLayers, const std::vector< TypeMapping > &pixelwiseTypeMapping, std::vector< std::unique_ptr< GeometricAnnotationData > > geometricAnnotationLayers, const std::vector< TypeMapping > &geometricAnnotationTypeMapping, Progress *progress=nullptr)
bool hasMultipleLayers () const
const PixelwiseData * pixelwise (std::optional< size_t >={}) const
const GeometricAnnotationData * geometricAnnotations (std::optional< size_t >={}) const
size_t numberPixelwiseLayers () const
size_t numberGeometricAnnotationLayers () const
void setActivePixelwise (std::optional< size_t >)
void setActiveGeometricAnnotations (std::optional< size_t >)
std::optional< size_t > activePixelwise () const
std::optional< size_t > activeGeometricAnnotations () const
const std::vector< std::unique_ptr< PixelwiseData > > & pixelwiseLayers () const
const std::vector< std::unique_ptr< GeometricAnnotationData > > & geometricAnnotationLayers () const
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
const Network::AuthorizationProviderauthProvider () const
 Provides authorization for a remote project and other web resources.
std::shared_ptr< Network::AuthorizationProviderauthProviderShared () const
int latestRemoteEventTimestamp () const
std::optional< int > queryAndApplyNewerEvents ()
bool applyRemoteEvent (int timestamp, const QJsonObject &jsonEvent)
QString loadInstructions () const
 Loads instructions for this project.
std::vector< std::stringdatasetGroupingHierachy () const
 Returns the values the project can be grouped by.
void setDatasetGroupingHierachy (const std::vector< std::string > &grouping)
 Changes the grouping hierachy.
Container::LRUCache< std::string, Utils::FileGuard > & localDataCache () const
Public Member Functions inherited from ImFusion::SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
Public Member Functions inherited from ImFusion::Configurable
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

Static Public Member Functions

static QJsonObject toJson (Settings settings, const std::vector< TagType > &tagTypes, const std::vector< std::unique_ptr< PixelwiseData > > &pixelwiseLayers, const std::vector< std::unique_ptr< GeometricAnnotationData > > &geometricAnnotationLayers)
 Converts the project parameters to JSON as used by the server.
static std::unique_ptr< Project > loadLocalProject (QString projectDir, const Properties &prop, bool readOnly)
 all the static functions below may throw if the data passed is invalid, with a human-readable exception message
static std::unique_ptr< Project > loadRemoteProject (const std::string &projectUrl, std::shared_ptr< Network::AuthorizationProvider > authProvider, Progress *progress=nullptr)
static std::unique_ptr< Project > createNewRemoteProject (Settings settings, const std::vector< TagType > &tagTypes, const std::vector< std::unique_ptr< PixelwiseData > > &pixelwiseLayers, const std::vector< std::unique_ptr< GeometricAnnotationData > > &geometricAnnotationLayers, std::shared_ptr< Network::AuthorizationProvider > authProvider, Progress *progress)
static std::unique_ptr< Project > createNewLocalProject (Settings settings, std::vector< std::unique_ptr< PixelwiseData > > pixelwiseLayers, std::vector< std::unique_ptr< GeometricAnnotationData > > geometricAnnotationLayers)
static std::unique_ptr< Project > dummyProject (ProjectTypes t, std::vector< std::unique_ptr< PixelwiseData > > pixelwiseLayers, std::vector< std::unique_ptr< GeometricAnnotationData > > geometricAnnotationLayers)
static bool isDatasetCompatible (const DataTypes &types, const ImageMetadata &meta)
static bool isRemoteProjectPath (const QString &projectPath)

Public Attributes

Signal descriptorsAdded
Signal< DataDescriptor * > descriptorModified
Signal descriptorOwningStateChanged
Signal< const DataDescriptor * > descriptorDeletedPre
Signal descriptorsDeleted
Signal< const DataDescriptor * > descriptorThumbnailChanged
Signal< const DataDescriptor *, const QString & > descriptorAnnotationThumbnailChanged
Signal< DataSet & > dataUnloadedPre
Signal< const DataDescriptor & > dataLoadedPre
Signal< DataSet & > dataLoadedPost
Signal< SharedImageSet &, Progress * > imageLoadedPost
Signal nameChanged
Signal< const QString &, const QString & > directoryChanged
Signal tagsChangedPre
Signal tagsChangedPost
Signal layersChangedPre
Signal layersChangedPost
Signal anyActiveLayerChangedPre
Signal anyActiveLayerChangedPost
Signal< const PixelwiseData * > activePixelwiseLayerChanged
Signal< const GeometricAnnotationData * > activeAnnotationLayerChanged
Signal< std::stringunhandledRemoteEvent
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.

Static Public Attributes

static const std::string LoadInterrupted

Additional Inherited Members

Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Member Enumeration Documentation

◆ FailureAction

Enumerator
Discard 

Don't save and potentially discard all changes (does not actively resets the changes, but just ignores the failing save).

Retry 

Try saving again with same settings.

Export 

Export all layers to an external file and discard the changes.

Member Function Documentation

◆ toJson()

QJsonObject ImFusion::Project::toJson ( Settings settings,
const std::vector< TagType > & tagTypes,
const std::vector< std::unique_ptr< PixelwiseData > > & pixelwiseLayers,
const std::vector< std::unique_ptr< GeometricAnnotationData > > & geometricAnnotationLayers )
static

Converts the project parameters to JSON as used by the server.

If this is a new project, Settings.m_projectPath should be empty and all ids should be -1. New tags, layers or labels should also use ids of -1 when editing an existing project.

◆ import()

ImportResult ImFusion::Project::import ( const std::vector< Import::Entry > & entries,
bool copyData,
LayersToModify layersToModify,
Progress * progress )

Imports the given entries to the project.

copyData specifies whether the datasets should be copied to the project folder or not. If the entries contain labelmaps, they are imported after the regular datasets (see importLayers for details). The ImportResult object contains info about datasets that could be loaded, those that could not be loaded (and the error message associated)

◆ switchDataSetWithProgress()

void ImFusion::Project::switchDataSetWithProgress ( DataDescriptor & desc,
QWidget * parent )

Switches to another dataset.

If there is a currentData, it is saved before loadDataSet is called. This method creates a progress dialog and will show a message box if an error occures. It must therefore only be called from UI code. Use loadDataSet otherwise.

◆ setFailureCallback()

void ImFusion::Project::setFailureCallback ( std::function< FailureActionAndPath(std::string)> callback)

Set a callback for failures that require some action from the user.

The callback receives a string containing a description of the error. The callback should decide on an action (e.g. with a dialog) and return the result. The callback might be called multiple times (e.g. retrying multiple times).

◆ permissions()

const Permissions & ImFusion::Project::permissions ( ) const
inline

Permissions of the current user for this project.

For local projects, all permissions are always true.

◆ configuration()

void ImFusion::Project::configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from ImFusion::Configurable.

◆ configure()

void ImFusion::Project::configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from ImFusion::Configurable.

◆ authProvider()

const Network::AuthorizationProvider & ImFusion::Project::authProvider ( ) const

Provides authorization for a remote project and other web resources.

Also available for local projects, in which case it's only used for datasets that are stored as DICOMweb or another web resource.

◆ loadInstructions()

QString ImFusion::Project::loadInstructions ( ) const

Loads instructions for this project.

For remote projects, instructions are loaded from the server. For local projects, instructions are loaded from an instructions.html in the project directory. Returns an empty string if the project doesn't have any instructions.

◆ datasetGroupingHierachy()

std::vector< std::string > ImFusion::Project::datasetGroupingHierachy ( ) const

Returns the values the project can be grouped by.

By default this is "Patient", "Study", "Series". It corresponds to the ImageMetadata::m_grouping field. Each group depends on the previous, e.g. grouping by "Study" will first group by "Patient" and then by "Study" inside each "Patient" group. This property is mainly used to show the grouping options in the UI.

◆ setDatasetGroupingHierachy()

void ImFusion::Project::setDatasetGroupingHierachy ( const std::vector< std::string > & grouping)

Changes the grouping hierachy.

This only changes the hierachy in the project, but won't change the current grouping in the datasets (because there is no generic way to determine a mapping). There is currently also no signal, because we assume that this is only changed from scripts and not through the Labels UI.


The documentation for this class was generated from the following file:
  • ImFusionLabels/lib/include/ImFusion/Labels/Core/Project.h
Search Tab / S to search, Esc to close