dicsubset.hpp

namespace subset

Functions

void get_px_from_img(subset::Pixels &ss_ref, const int ss_x, const int ss_y, const int px_hori, const int px_vert, const double *img_def)

Extracts a square subset of pixels from an image and stores the data in a Subset object.

This function copies a square region of pixel data from the specified starting coordinates (ss_x, ss_y) in the input image into the ss_def structure. The size of the square subset is determined by ss_def->size. Both the pixel values and their corresponding coordinates are stored in ss_def.

Parameters:
  • ss_x – X-coordinate (column) of the top-left corner of the subset in the image.

  • ss_y – Y-coordinate (row) of the top-left corner of the subset in the image.

  • img_def – Pointer to the source image (util::Image) from which to extract pixel data.

  • ss_def – Pointer to the destination subset (subset::Pixels) where extracted pixel values and coordinates are stored.

void get_subpx_from_img(subset::Pixels &ss_def, const double subpx_x, const double subpx_y, const Interpolator &interp_def)

Extracts a square subset of pixels from an image and stores the data in a Subset object.

This function copies a square region of pixel data from the specified starting coordinates (ss_x, ss_y) in the input image into the ss_def structure. The size of the square subset is determined by ss_def->size. Both the pixel values and their corresponding coordinates are stored in ss_def.

Parameters:
  • ss_ref – Pointer to the destination subset (subset::Pixels) where extracted pixel info will be stored

  • ss_x – X-coordinate (column) of the top-left corner of the subset in the image.

  • ss_y – Y-coordinate (row) of the top-left corner of the subset in the image.

  • interp_ref – interpolator for the reference image from which to extract pixel data.

void get_subpx_from_shape_params(subset::Pixels &ss_def, const double subpx_x, const double subpx_y, const std::vector<double> &p, const Interpolator &interp_def)
subset::Grid create_grid(const bool *img_roi, const int ss_step, const int ss_size, const int px_hori, const int px_vert, const bool partial = false)

Generates a list of subsets based on the provided image ROI and parameters.

This function creates a list of subsets (defined by their coordinates) from a binary mask (img_roi) that indicates the region of interest in the image. The subsets are generated with specified size and step values.

Parameters:
  • img_roi – Pointer to a binary mask indicating the region of interest in the image.

  • px_hori – Number of horizontal pixels in the image.

  • px_vert – Number of vertical pixels in the image.

  • ss_size – Size of each subset (in pixels).

  • ss_step – Step size for generating subsets.

Returns:

A subset::Grid object containing the generated subsets and their neighbours.

inline bool px_in_img_dims(const int px_x, const int px_y, const int px_hori, const int px_vert)
inline bool px_in_roi(const int px_x, const int px_y, const int px_hori, const int px_vert, const bool *img_roi)
struct Grid

Public Members

int num
int step
int size
int num_ss_x
int num_ss_y
int num_in_mask
std::vector<int> coords
std::vector<int> mask
std::vector<std::vector<int>> neigh
struct Pixels
#include <dicsubset.hpp>

holds a subset with pixel data and dimensions.

This struct holds the pixel values, coordinates, and dimensions of a square subset.

Public Functions

inline Pixels(int ss_size)

Public Members

std::vector<double> vals
std::vector<double> x
std::vector<double> y
int size
int num_px