Skip to main content

MediaData

MediaData

#include <Media_Data.hpp>

Inherits from ObserverData

Inherited by EmptyMediaData, HDF5Data, ImageData, VideoData

Public Types

Name
enum class MediaType { Video, Images, HDF5}
enum DisplayFormat { Gray, Color}
using MediaStorage::BitDepth BitDepth
using MediaStorage::ImageDataVariant DataStorage

Public Functions

Name
MediaData()
virtual ~MediaData()
virtual MediaType getMediaType() const =0
Get the media type of this instance.
std::string getFilename() const
void setFilename(std::string const & filename)
void setFormat(DisplayFormat format)
DisplayFormat getFormat() const
int getHeight() const
int getWidth() const
ImageSize getImageSize() const
void updateHeight(int height)
void updateWidth(int width)
int getTotalFrameCount() const
void setTotalFrameCount(int total_frame_count)
BitDepth getBitDepth() const
Get the current bit depth of the media data.
void setBitDepth(BitDepth depth)
Set the bit depth (can be used to override auto-detected depth).
bool is8Bit() const
Check if the media data is using 8-bit storage.
bool is32Bit() const
Check if the media data is using 32-bit float storage.
void LoadMedia(std::string const & name)
LoadMedia.
void LoadFrame(int frame_id)
LoadFrame.
virtual std::string GetFrameID(int frame_id) const
virtual int getFrameIndexFromNumber(int frame_id)
std::vector< uint8_t > const & getRawData8(int frame_number)
Get raw data as uint8_t (for 8-bit data or converted from 32-bit).
std::vector< float > const & getRawData32(int frame_number)
Get raw data as float (for 32-bit data or converted from 8-bit).
std::vector< uint8_t > getProcessedData8(int frame_number)
Get processed data as uint8_t (for 8-bit data or converted from 32-bit).
std::vector< float > getProcessedData32(int frame_number)
Get processed data as float (for 32-bit data or converted from 8-bit).
DataStorage const & getRawDataVariant(int frame_number)
Get raw data as variant (native format).
DataStorage getProcessedDataVariant(int frame_number)
Get processed data as variant (native format).
std::vector< uint8_t > const & getRawData(int frame_number)
Legacy method - get raw data (defaults to 8-bit behavior for compatibility).
std::vector< uint8_t > getProcessedData(int frame_number)
Legacy method - get processed data (defaults to 8-bit behavior for compatibility).
void setRawData(MediaStorage::ImageData8 data)
Set raw data from uint8_t vector.
void setRawData(MediaStorage::ImageData32 data)
Set raw data from float vector (normalized to 0-255 range).
bool setImageProcessor(std::string const & processor_name)
Set the image processor backend (e.g., “opencv”, “simd”, etc.).
std::string getImageProcessorName() const
Get the current image processor backend name.
void addProcessingStep(std::string const & key, std::function< void(void *)> processor)
Add a processing step using the current processor.
void removeProcessingStep(std::string const & key)
Remove a processing step.
void clearProcessingSteps()
Clear all processing steps.
bool hasProcessingStep(std::string const & key) const
Check if a processing step exists.
size_t getProcessingStepCount() const
Get the number of processing steps.
void setTimeFrame(std::shared_ptr< TimeFrame > time_frame)
Set the time frame.
std::shared_ptr< TimeFrame > getTimeFrame() const

Protected Functions

Name
virtual void doLoadMedia(std::string const & name)
virtual void doLoadFrame(int frame_id)

Additional inherited members

Public Classes inherited from ObserverData

Name
struct ObserverEntry
Entry in the observer map.

Public Types inherited from ObserverData

Name
using std::function< void()> ObserverCallback
Type alias for observer callback functions.
using int CallbackID
Type alias for callback identifiers.

Public Functions inherited from ObserverData

Name
ObserverData(std::string name =“UnnamedObservable”)
CallbackID addObserver(ObserverCallback callback, std::string name =“Anonymous”)
Register a new observer callback.
void notifyObservers()
Notify all registered observers.
void removeObserver(CallbackID id)
Remove a previously registered observer.

Public Types Documentation

enum MediaType

Enumerator Value Description
Video
Images
HDF5

enum DisplayFormat

Enumerator Value Description
Gray
Color

using BitDepth

using MediaData::BitDepth =  MediaStorage::BitDepth;

using DataStorage

using MediaData::DataStorage =  MediaStorage::ImageDataVariant;

Public Functions Documentation

function MediaData

MediaData()

function ~MediaData

virtual ~MediaData()

function getMediaType

virtual MediaType getMediaType() const =0

Get the media type of this instance.

Return: The MediaType enum value

Reimplemented by: EmptyMediaData::getMediaType, HDF5Data::getMediaType, ImageData::getMediaType, VideoData::getMediaType

function getFilename

inline std::string getFilename() const

function setFilename

inline void setFilename(
    std::string const & filename
)

function setFormat

void setFormat(
    DisplayFormat format
)

function getFormat

inline DisplayFormat getFormat() const

function getHeight

inline int getHeight() const

function getWidth

inline int getWidth() const

function getImageSize

inline ImageSize getImageSize() const

function updateHeight

void updateHeight(
    int height
)

function updateWidth

void updateWidth(
    int width
)

function getTotalFrameCount

inline int getTotalFrameCount() const

function setTotalFrameCount

inline void setTotalFrameCount(
    int total_frame_count
)

function getBitDepth

inline BitDepth getBitDepth() const

Get the current bit depth of the media data.

Return: Current BitDepth enum value

function setBitDepth

void setBitDepth(
    BitDepth depth
)

Set the bit depth (can be used to override auto-detected depth).

Parameters:

  • depth The desired bit depth

function is8Bit

inline bool is8Bit() const

Check if the media data is using 8-bit storage.

Return: true if using 8-bit, false if using 32-bit float

function is32Bit

inline bool is32Bit() const

Check if the media data is using 32-bit float storage.

Return: true if using 32-bit float, false if using 8-bit

function LoadMedia

void LoadMedia(
    std::string const & name
)

LoadMedia.

Parameters:

  • name points to the path to the file or folder

function LoadFrame

void LoadFrame(
    int frame_id
)

LoadFrame.

Parameters:

  • frame_id

Subclasses will specify how to load a specific frame given by frame_id This will populate the data class member with a vector of raw uint8_t

function GetFrameID

inline virtual std::string GetFrameID(
    int frame_id
) const

Reimplemented by: HDF5Data::GetFrameID, ImageData::GetFrameID, VideoData::GetFrameID

function getFrameIndexFromNumber

inline virtual int getFrameIndexFromNumber(
    int frame_id
)

Reimplemented by: HDF5Data::getFrameIndexFromNumber, ImageData::getFrameIndexFromNumber, VideoData::getFrameIndexFromNumber

function getRawData8

std::vector< uint8_t > const & getRawData8(
    int frame_number
)

Get raw data as uint8_t (for 8-bit data or converted from 32-bit).

Parameters:

  • frame_number Frame number to load

Return: Reference to uint8_t vector

function getRawData32

std::vector< float > const & getRawData32(
    int frame_number
)

Get raw data as float (for 32-bit data or converted from 8-bit).

Parameters:

  • frame_number Frame number to load

Return: Reference to float vector

function getProcessedData8

std::vector< uint8_t > getProcessedData8(
    int frame_number
)

Get processed data as uint8_t (for 8-bit data or converted from 32-bit).

Parameters:

  • frame_number Frame number to load

Return: Copy of uint8_t vector (since processing may modify it)

function getProcessedData32

std::vector< float > getProcessedData32(
    int frame_number
)

Get processed data as float (for 32-bit data or converted from 8-bit).

Parameters:

  • frame_number Frame number to load

Return: Copy of float vector (since processing may modify it)

function getRawDataVariant

DataStorage const & getRawDataVariant(
    int frame_number
)

Get raw data as variant (native format).

Parameters:

  • frame_number Frame number to load

Return: DataStorage variant containing the raw data

function getProcessedDataVariant

DataStorage getProcessedDataVariant(
    int frame_number
)

Get processed data as variant (native format).

Parameters:

  • frame_number Frame number to load

Return: DataStorage variant containing the processed data

function getRawData

inline std::vector< uint8_t > const & getRawData(
    int frame_number
)

Legacy method - get raw data (defaults to 8-bit behavior for compatibility).

Parameters:

  • frame_number Frame number to load

Return: Reference to uint8_t vector

function getProcessedData

inline std::vector< uint8_t > getProcessedData(
    int frame_number
)

Legacy method - get processed data (defaults to 8-bit behavior for compatibility).

Parameters:

  • frame_number Frame number to load

Return: Copy of uint8_t vector

function setRawData

void setRawData(
    MediaStorage::ImageData8 data
)

Set raw data from uint8_t vector.

Parameters:

  • data The 8-bit data to set

function setRawData

void setRawData(
    MediaStorage::ImageData32 data
)

Set raw data from float vector (normalized to 0-255 range).

Parameters:

  • data The 32-bit float data to set

function setImageProcessor

bool setImageProcessor(
    std::string const & processor_name
)

Set the image processor backend (e.g., “opencv”, “simd”, etc.).

Parameters:

  • processor_name Name of the registered processor

Return: true if the processor was successfully set, false otherwise

function getImageProcessorName

std::string getImageProcessorName() const

Get the current image processor backend name.

Return: Name of the current processor, or empty string if none set

function addProcessingStep

void addProcessingStep(
    std::string const & key,
    std::function< void(void *)> processor
)

Add a processing step using the current processor.

Parameters:

  • key Unique identifier for the processing step
  • processor Generic processing function

function removeProcessingStep

void removeProcessingStep(
    std::string const & key
)

Remove a processing step.

Parameters:

  • key Identifier of the processing step to remove

function clearProcessingSteps

void clearProcessingSteps()

Clear all processing steps.

function hasProcessingStep

bool hasProcessingStep(
    std::string const & key
) const

Check if a processing step exists.

Parameters:

  • key Identifier to check

Return: true if the step exists, false otherwise

function getProcessingStepCount

size_t getProcessingStepCount() const

Get the number of processing steps.

Return: Number of steps in the processing chain

function setTimeFrame

inline void setTimeFrame(
    std::shared_ptr< TimeFrame > time_frame
)

Set the time frame.

Parameters:

  • time_frame The time frame to set

function getTimeFrame

inline std::shared_ptr< TimeFrame > getTimeFrame() const

Protected Functions Documentation

function doLoadMedia

inline virtual void doLoadMedia(
    std::string const & name
)

Reimplemented by: EmptyMediaData::doLoadMedia, HDF5Data::doLoadMedia, ImageData::doLoadMedia, VideoData::doLoadMedia

function doLoadFrame

inline virtual void doLoadFrame(
    int frame_id
)

Reimplemented by: EmptyMediaData::doLoadFrame, HDF5Data::doLoadFrame, ImageData::doLoadFrame, VideoData::doLoadFrame


Updated on 2026-11-13 at 20:25:40 +0000