src/DataManager/transforms/Lines/Line_Alignment/line_alignment.hpp
src/DataManager/transforms/Lines/Line_Alignment/line_alignment.hpp
Classes
| Name | |
|---|---|
| struct | LineAlignmentParameters |
| class | LineAlignmentOperation |
Types
| Name | |
|---|---|
| enum class | FWHMApproach { PEAK_WIDTH_HALF_MAX, GAUSSIAN_FIT, THRESHOLD_BASED} Enum for FWHM calculation approach. |
| enum class | LineAlignmentOutputMode { ALIGNED_VERTICES, FWHM_PROFILE_EXTENTS} Enum for output mode. |
Functions
| Name | |
|---|---|
| template <typename T > Point2D< float > |
calculate_fwhm_center(Point2D< float > const & vertex, Point2D< float > const & perpendicular_dir, int width, int perpendicular_range, std::vector< T > const & image_data, ImageSize const & image_size, FWHMApproach approach =FWHMApproach::PEAK_WIDTH_HALF_MAX) Calculate FWHM center point for a single vertex. |
| template <typename T > Line2D |
calculate_fwhm_profile_extents(Point2D< float > const & vertex, Point2D< float > const & perpendicular_dir, int width, int perpendicular_range, std::vector< T > const & image_data, ImageSize const & image_size, FWHMApproach approach =FWHMApproach::PEAK_WIDTH_HALF_MAX) Calculate FWHM profile extents for a single vertex. |
| std::shared_ptr< LineData > | line_alignment(LineData const * line_data, MediaData * media_data, int width =20, int perpendicular_range =50, bool use_processed_data =true, FWHMApproach approach =FWHMApproach::PEAK_WIDTH_HALF_MAX, LineAlignmentOutputMode output_mode =LineAlignmentOutputMode::ALIGNED_VERTICES, LineAlignmentParameters const * params =[nullptr]) Align a line to bright linear objects in media data. |
| std::shared_ptr< LineData > | line_alignment(LineData const * line_data, MediaData * media_data, int width, int perpendicular_range, bool use_processed_data, FWHMApproach approach, LineAlignmentOutputMode output_mode, LineAlignmentParameters const * params, ProgressCallback progressCallback) Align a line to bright linear objects in media data with progress callback. |
| template Point2D< float > | calculate_fwhm_center< uint8_t >(Point2D< float > const & vertex, Point2D< float > const & perpendicular_dir, int width, int perpendicular_range, std::vector< uint8_t > const & image_data, ImageSize const & image_size, FWHMApproach approach) |
| template Point2D< float > | calculate_fwhm_center< float >(Point2D< float > const & vertex, Point2D< float > const & perpendicular_dir, int width, int perpendicular_range, std::vector< float > const & image_data, ImageSize const & image_size, FWHMApproach approach) |
| template Line2D | calculate_fwhm_profile_extents< uint8_t >(Point2D< float > const & vertex, Point2D< float > const & perpendicular_dir, int width, int perpendicular_range, std::vector< uint8_t > const & image_data, ImageSize const & image_size, FWHMApproach approach) |
| template Line2D | calculate_fwhm_profile_extents< float >(Point2D< float > const & vertex, Point2D< float > const & perpendicular_dir, int width, int perpendicular_range, std::vector< float > const & image_data, ImageSize const & image_size, FWHMApproach approach) |
Types Documentation
enum FWHMApproach
| Enumerator | Value | Description |
|---|---|---|
| PEAK_WIDTH_HALF_MAX | ||
| GAUSSIAN_FIT | ||
| THRESHOLD_BASED |
Enum for FWHM calculation approach.
enum LineAlignmentOutputMode
| Enumerator | Value | Description |
|---|---|---|
| ALIGNED_VERTICES | ||
| FWHM_PROFILE_EXTENTS |
Enum for output mode.
Functions Documentation
function calculate_fwhm_center
template <typename T >
Point2D< float > calculate_fwhm_center(
Point2D< float > const & vertex,
Point2D< float > const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector< T > const & image_data,
ImageSize const & image_size,
FWHMApproach approach =FWHMApproach::PEAK_WIDTH_HALF_MAX
)Calculate FWHM center point for a single vertex.
Parameters:
- vertex The vertex position
- perpendicular_dir The perpendicular direction
- width The width of the analysis strip
- image_data The image data as uint8_t vector
- image_size The image dimensions
- approach The FWHM calculation approach
Return: The center point of the bright feature along the perpendicular direction
function calculate_fwhm_profile_extents
template <typename T >
Line2D calculate_fwhm_profile_extents(
Point2D< float > const & vertex,
Point2D< float > const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector< T > const & image_data,
ImageSize const & image_size,
FWHMApproach approach =FWHMApproach::PEAK_WIDTH_HALF_MAX
)Calculate FWHM profile extents for a single vertex.
Parameters:
- vertex The vertex position
- perpendicular_dir The perpendicular direction
- width The width of the analysis strip
- image_data The image data as uint8_t vector
- image_size The image dimensions
- approach The FWHM calculation approach
Return: A line with 3 points: [left_extent, max_point, right_extent]
function line_alignment
std::shared_ptr< LineData > line_alignment(
LineData const * line_data,
MediaData * media_data,
int width =20,
int perpendicular_range =50,
bool use_processed_data =true,
FWHMApproach approach =FWHMApproach::PEAK_WIDTH_HALF_MAX,
LineAlignmentOutputMode output_mode =LineAlignmentOutputMode::ALIGNED_VERTICES,
LineAlignmentParameters const * params =nullptr
)Align a line to bright linear objects in media data.
Parameters:
- line_data The input line data
- media_data The media data containing the images
- width The width of the analysis strip perpendicular to the line
- perpendicular_range The range of perpendicular analysis
- use_processed_data Whether to use processed or raw media data
- approach The FWHM calculation approach
- output_mode The output mode (aligned vertices or FWHM profile extents)
- params Parameters including grouping settings
Return: A new LineData with aligned vertices or FWHM profile extents
function line_alignment
std::shared_ptr< LineData > line_alignment(
LineData const * line_data,
MediaData * media_data,
int width,
int perpendicular_range,
bool use_processed_data,
FWHMApproach approach,
LineAlignmentOutputMode output_mode,
LineAlignmentParameters const * params,
ProgressCallback progressCallback
)Align a line to bright linear objects in media data with progress callback.
Parameters:
- line_data The input line data
- media_data The media data containing the images
- width The width of the analysis strip perpendicular to the line
- perpendicular_range The range of perpendicular analysis
- use_processed_data Whether to use processed or raw media data
- approach The FWHM calculation approach
- output_mode The output mode (aligned vertices or FWHM profile extents)
- params Parameters including grouping settings
- progressCallback Progress callback function
Return: A new LineData with aligned vertices or FWHM profile extents
function calculate_fwhm_center< uint8_t >
template Point2D< float > calculate_fwhm_center< uint8_t >(
Point2D< float > const & vertex,
Point2D< float > const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector< uint8_t > const & image_data,
ImageSize const & image_size,
FWHMApproach approach
)function calculate_fwhm_center< float >
template Point2D< float > calculate_fwhm_center< float >(
Point2D< float > const & vertex,
Point2D< float > const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector< float > const & image_data,
ImageSize const & image_size,
FWHMApproach approach
)function calculate_fwhm_profile_extents< uint8_t >
template Line2D calculate_fwhm_profile_extents< uint8_t >(
Point2D< float > const & vertex,
Point2D< float > const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector< uint8_t > const & image_data,
ImageSize const & image_size,
FWHMApproach approach
)function calculate_fwhm_profile_extents< float >
template Line2D calculate_fwhm_profile_extents< float >(
Point2D< float > const & vertex,
Point2D< float > const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector< float > const & image_data,
ImageSize const & image_size,
FWHMApproach approach
)Source code
#ifndef LINE_ALIGNMENT_HPP
#define LINE_ALIGNMENT_HPP
#include "transforms/data_transforms.hpp"
#include "CoreGeometry/Image.hpp"
#include "CoreGeometry/ImageSize.hpp"
#include "CoreGeometry/line_geometry.hpp"
#include "CoreGeometry/lines.hpp"
#include "CoreGeometry/points.hpp"
#include <memory> // std::shared_ptr
#include <string> // std::string
#include <typeindex>// std::type_index
#include <vector> // std::vector
class LineData;
class MediaData;
enum class FWHMApproach {
PEAK_WIDTH_HALF_MAX,// Width at 1/2 maximum height
GAUSSIAN_FIT, // Gaussian curve fitting
THRESHOLD_BASED // Threshold-based peak detection
};
enum class LineAlignmentOutputMode {
ALIGNED_VERTICES, // Return aligned line vertices (normal mode)
FWHM_PROFILE_EXTENTS// Return FWHM profile extents for debugging/analysis
};
struct LineAlignmentParameters : public TransformParametersBase {
std::shared_ptr<MediaData> media_data; // Pointer to the MediaData
int width = 20; // Width of analysis strip
int perpendicular_range = 50; // Range of perpendicular analysis (pixels)
bool use_processed_data = true; // Whether to use processed or raw data
FWHMApproach approach = FWHMApproach::PEAK_WIDTH_HALF_MAX; // FWHM calculation approach
LineAlignmentOutputMode output_mode = LineAlignmentOutputMode::ALIGNED_VERTICES;// Output mode
};
template<typename T>
Point2D<float> calculate_fwhm_center(Point2D<float> const & vertex,
Point2D<float> const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector<T> const & image_data,
ImageSize const & image_size,
FWHMApproach approach = FWHMApproach::PEAK_WIDTH_HALF_MAX);
template<typename T>
Line2D calculate_fwhm_profile_extents(Point2D<float> const & vertex,
Point2D<float> const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector<T> const & image_data,
ImageSize const & image_size,
FWHMApproach approach = FWHMApproach::PEAK_WIDTH_HALF_MAX);
std::shared_ptr<LineData> line_alignment(LineData const * line_data,
MediaData * media_data,
int width = 20,
int perpendicular_range = 50,
bool use_processed_data = true,
FWHMApproach approach = FWHMApproach::PEAK_WIDTH_HALF_MAX,
LineAlignmentOutputMode output_mode = LineAlignmentOutputMode::ALIGNED_VERTICES,
LineAlignmentParameters const * params = nullptr);
std::shared_ptr<LineData> line_alignment(LineData const * line_data,
MediaData * media_data,
int width,
int perpendicular_range,
bool use_processed_data,
FWHMApproach approach,
LineAlignmentOutputMode output_mode,
LineAlignmentParameters const * params,
ProgressCallback progressCallback);
class LineAlignmentOperation final : public TransformOperation {
public:
[[nodiscard]] std::string getName() const override;
[[nodiscard]] std::type_index getTargetInputTypeIndex() const override;
[[nodiscard]] bool canApply(DataTypeVariant const & dataVariant) const override;
[[nodiscard]] std::unique_ptr<TransformParametersBase> getDefaultParameters() const override;
DataTypeVariant execute(DataTypeVariant const & dataVariant,
TransformParametersBase const * transformParameters) override;
// Overload with progress
DataTypeVariant execute(DataTypeVariant const & dataVariant,
TransformParametersBase const * transformParameters,
ProgressCallback progressCallback) override;
};
extern template Point2D<float> calculate_fwhm_center<uint8_t>(Point2D<float> const & vertex,
Point2D<float> const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector<uint8_t> const & image_data,
ImageSize const & image_size,
FWHMApproach approach);
extern template Point2D<float> calculate_fwhm_center<float>(Point2D<float> const & vertex,
Point2D<float> const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector<float> const & image_data,
ImageSize const & image_size,
FWHMApproach approach);
extern template Line2D calculate_fwhm_profile_extents<uint8_t>(Point2D<float> const & vertex,
Point2D<float> const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector<uint8_t> const & image_data,
ImageSize const & image_size,
FWHMApproach approach);
extern template Line2D calculate_fwhm_profile_extents<float>(Point2D<float> const & vertex,
Point2D<float> const & perpendicular_dir,
int width,
int perpendicular_range,
std::vector<float> const & image_data,
ImageSize const & image_size,
FWHMApproach approach);
#endif//LINE_ALIGNMENT_HPPUpdated on 2026-11-13 at 20:25:43 +0000