Volume Cartographer 2.27.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
volcart::texturing::ScaleMarkerGenerator Class Reference

Add a scale marker (ruler or reference image) to a Texture image. More...

#include <vc/texturing/ScaleMarkerGenerator.hpp>

Public Types

enum class  Type { Metric = 0 , Imperial , ReferenceImage }
 Scale marker type. More...
 

Public Member Functions

 ScaleMarkerGenerator ()=default
 
void setScaleType (Type t)
 Set the scale marker type. More...
 
void setInputImage (const cv::Mat &i)
 Set the input texture image. More...
 
void setInputImagePixelSize (double s)
 Set the input texture image pixel size (in microns) More...
 
void setScaleBarColor (const Color &c)
 Set the scale bar (ruler) color. More...
 
void setReferenceImage (const cv::Mat &i)
 Set the scale reference image. More...
 
void setReferenceImagePixelSize (double s)
 Set the reference image pixel size (in microns) More...
 
cv::Mat compute ()
 Compute scale marker and combine with input texture image. More...
 
cv::Mat getOutputImg ()
 Get the computed output image. More...
 
cv::Mat getOutputScaleImage ()
 Get the computed scale marker image. More...
 

Private Member Functions

cv::Mat resize_ref_image_ ()
 
cv::Mat generate_scale_bar_ ()
 
void draw_tick_label_ (cv::Mat img, const std::string &value, const cv::Point &position)
 

Private Attributes

Type type_ {Type::Metric}
 
cv::Mat inputImg_
 
double inputImgPixSize_ {1.0}
 
cv::Mat scaleImg_
 
cv::Mat outputImg_
 
Color scaleBarColor_ {volcart::color::WHITE}
 
cv::Mat refImg_
 
double refImgPixSize_ {1.0}
 
double scaleFactor_ {1.0}
 
std::string scaleUnit_ {"cm"}
 

Detailed Description

Add a scale marker (ruler or reference image) to a Texture image.

Author
Kyra Seevers

Adds a ruler bar or a reference image to a Texture image to aid with identifying features and text. To be accurate, the pixel size (in microns) must be set for all provided images.

Input images must be 1 or 3 channels. Output images will be 8bpc RGB.

Definition at line 22 of file ScaleMarkerGenerator.hpp.

Member Enumeration Documentation

◆ Type

Scale marker type.

Definition at line 26 of file ScaleMarkerGenerator.hpp.

Constructor & Destructor Documentation

◆ ScaleMarkerGenerator()

volcart::texturing::ScaleMarkerGenerator::ScaleMarkerGenerator ( )
default

Default constructor

Member Function Documentation

◆ compute()

cv::Mat volcart::texturing::ScaleMarkerGenerator::compute ( )

Compute scale marker and combine with input texture image.

Exceptions
std::domain_error

◆ draw_tick_label_()

void volcart::texturing::ScaleMarkerGenerator::draw_tick_label_ ( cv::Mat  img,
const std::string &  value,
const cv::Point &  position 
)
private

Draw a unit label "value + scaleUnit_" at the given position

◆ generate_scale_bar_()

cv::Mat volcart::texturing::ScaleMarkerGenerator::generate_scale_bar_ ( )
private

Generate a scale bar at the resolution of the input texture image

◆ getOutputImg()

cv::Mat volcart::texturing::ScaleMarkerGenerator::getOutputImg ( )
inline

Get the computed output image.

Returned image is the input texture image with the scale marker.

Definition at line 69 of file ScaleMarkerGenerator.hpp.

◆ getOutputScaleImage()

cv::Mat volcart::texturing::ScaleMarkerGenerator::getOutputScaleImage ( )
inline

Get the computed scale marker image.

Returned image is only the scale marker.

Definition at line 76 of file ScaleMarkerGenerator.hpp.

◆ resize_ref_image_()

cv::Mat volcart::texturing::ScaleMarkerGenerator::resize_ref_image_ ( )
private

Resize the reference image to resolution of the input texture image

◆ setInputImage()

void volcart::texturing::ScaleMarkerGenerator::setInputImage ( const cv::Mat &  i)
inline

Set the input texture image.

Definition at line 35 of file ScaleMarkerGenerator.hpp.

◆ setInputImagePixelSize()

void volcart::texturing::ScaleMarkerGenerator::setInputImagePixelSize ( double  s)
inline

Set the input texture image pixel size (in microns)

Definition at line 38 of file ScaleMarkerGenerator.hpp.

◆ setReferenceImage()

void volcart::texturing::ScaleMarkerGenerator::setReferenceImage ( const cv::Mat &  i)
inline

Set the scale reference image.

Used when the scale type is Type::ReferenceImage.

Definition at line 52 of file ScaleMarkerGenerator.hpp.

◆ setReferenceImagePixelSize()

void volcart::texturing::ScaleMarkerGenerator::setReferenceImagePixelSize ( double  s)
inline

Set the reference image pixel size (in microns)

Definition at line 55 of file ScaleMarkerGenerator.hpp.

◆ setScaleBarColor()

void volcart::texturing::ScaleMarkerGenerator::setScaleBarColor ( const Color c)
inline

Set the scale bar (ruler) color.

Used when the scale type is Type::Imperial or Type::Metric.

Definition at line 45 of file ScaleMarkerGenerator.hpp.

◆ setScaleType()

void volcart::texturing::ScaleMarkerGenerator::setScaleType ( Type  t)
inline

Set the scale marker type.

Definition at line 32 of file ScaleMarkerGenerator.hpp.

Member Data Documentation

◆ inputImg_

cv::Mat volcart::texturing::ScaleMarkerGenerator::inputImg_
private

Input texture image

Definition at line 83 of file ScaleMarkerGenerator.hpp.

◆ inputImgPixSize_

double volcart::texturing::ScaleMarkerGenerator::inputImgPixSize_ {1.0}
private

Pixel size of input texture image (in microns)

Definition at line 85 of file ScaleMarkerGenerator.hpp.

◆ outputImg_

cv::Mat volcart::texturing::ScaleMarkerGenerator::outputImg_
private

Output texture image + scale image

Definition at line 90 of file ScaleMarkerGenerator.hpp.

◆ refImg_

cv::Mat volcart::texturing::ScaleMarkerGenerator::refImg_
private

Input reference image

Definition at line 96 of file ScaleMarkerGenerator.hpp.

◆ refImgPixSize_

double volcart::texturing::ScaleMarkerGenerator::refImgPixSize_ {1.0}
private

Pixel size of input reference image (in microns)

Definition at line 98 of file ScaleMarkerGenerator.hpp.

◆ scaleBarColor_

Color volcart::texturing::ScaleMarkerGenerator::scaleBarColor_ {volcart::color::WHITE}
private

Color of scale bar

Definition at line 93 of file ScaleMarkerGenerator.hpp.

◆ scaleFactor_

double volcart::texturing::ScaleMarkerGenerator::scaleFactor_ {1.0}
private

Conversion scale factor between constituent images

Definition at line 101 of file ScaleMarkerGenerator.hpp.

◆ scaleImg_

cv::Mat volcart::texturing::ScaleMarkerGenerator::scaleImg_
private

Generated scale image

Definition at line 88 of file ScaleMarkerGenerator.hpp.

◆ scaleUnit_

std::string volcart::texturing::ScaleMarkerGenerator::scaleUnit_ {"cm"}
private

Text version of scale unit

Definition at line 103 of file ScaleMarkerGenerator.hpp.

◆ type_

Type volcart::texturing::ScaleMarkerGenerator::type_ {Type::Metric}
private

Scale marker type

Definition at line 80 of file ScaleMarkerGenerator.hpp.


The documentation for this class was generated from the following file: