![]() |
CARTA Backend
The backend component of CARTA
|
Namespaces | |
namespace | FileInfo |
namespace | logger |
Typedefs | |
using | TilePtr = std::shared_ptr< std::vector< float > > |
typedef const std::function< void(double, double, const std::vector< float > &, const std::vector< int32_t > &)> | ContourCallback |
typedef uWS::HttpRequest | Req |
typedef uWS::HttpResponse< false > | Res |
typedef std::function< bool(int &, uint32_t &, std::string &, std::string &, std::string &, bool &, std::string &, ScriptingResponseCallback, ScriptingSessionClosedCallback)> | ScriptingRequestHandler |
using | HistogramBounds = Bounds< double > |
typedef std::function< void(const bool &, const std::string &, const std::string &)> | ScriptingResponseCallback |
typedef std::function< void()> | ScriptingSessionClosedCallback |
typedef std::vector< int64_t > | IndexList |
Enumerations | |
enum | Edge { TopEdge , RightEdge , BottomEdge , LeftEdge , None } |
Functions | |
int | Compress (std::vector< float > &array, size_t offset, std::vector< char > &compression_buffer, size_t &compressed_size, uint32_t nx, uint32_t ny, uint32_t precision) |
int | Decompress (std::vector< float > &array, std::vector< char > &compression_buffer, int nx, int ny, int precision) |
std::vector< int32_t > | GetNanEncodingsSimple (std::vector< float > &array, int offset, int length) |
std::vector< int32_t > | GetNanEncodingsBlock (std::vector< float > &array, int offset, int w, int h) |
void | RoundAndEncodeVertices (const std::vector< float > &array, std::vector< int32_t > &dest, float rounding_factor) |
void | EncodeIntegers (std::vector< int32_t > &array, bool strided) |
int | Compress (std::vector< float > &array, size_t offset, std::vector< char > &compression_buffer, std::size_t &compressed_size, uint32_t nx, uint32_t ny, uint32_t precision) |
void | TraceSegment (const float *image, std::vector< bool > &visited, int64_t width, int64_t height, double scale, double offset, double level, int x_cell, int y_cell, int side, vector< float > &vertices) |
void | TraceLevel (const float *image, int64_t width, int64_t height, double scale, double offset, double level, vector< float > &vertices, vector< int32_t > &indices, int chunk_size, ContourCallback &partial_callback) |
void | TraceContours (float *image, int64_t width, int64_t height, double scale, double offset, const std::vector< double > &levels, std::vector< std::vector< float > > &vertex_data, std::vector< std::vector< int32_t > > &index_data, int chunk_size, ContourCallback &partial_callback) |
void | TraceContourLevel (float *image, int64_t width, int64_t height, double scale, double offset, double level, std::vector< double > &vertex_data, std::vector< int32_t > &indices) |
double | NormPdf (double x, double sigma) |
void | MakeKernel (vector< float > &kernel, double sigma) |
bool | RunKernel (const vector< float > &kernel, const float *src_data, float *dest_data, const int64_t src_width, const int64_t src_height, const int64_t dest_width, const int64_t dest_height, const bool vertical) |
bool | GaussianSmooth (const float *src_data, float *dest_data, int64_t src_width, int64_t src_height, int64_t dest_width, int64_t dest_height, int smoothing_factor) |
bool | BlockSmooth (const float *src_data, float *dest_data, int64_t src_width, int64_t src_height, int64_t dest_width, int64_t dest_height, int64_t x_offset, int64_t y_offset, int smoothing_factor) |
bool | BlockSmoothSSE (const float *src_data, float *dest_data, int64_t src_width, int64_t src_height, int64_t dest_width, int64_t dest_height, int64_t x_offset, int64_t y_offset, int smoothing_factor) |
bool | BlockSmoothScalar (const float *src_data, float *dest_data, int64_t src_width, int64_t src_height, int64_t dest_width, int64_t dest_height, int64_t x_offset, int64_t y_offset, int smoothing_factor) |
void | NearestNeighbor (const float *src_data, float *dest_data, int64_t src_width, int64_t dest_width, int64_t dest_height, int64_t x_offset, int64_t y_offset, int smoothing_factor) |
static __m128 | IsInfinity (__m128 x) |
void | MakeKernel (std::vector< float > &kernel, double sigma) |
bool | RunKernel (const std::vector< float > &kernel, const float *src_data, float *dest_data, int64_t src_width, int64_t src_height, int64_t dest_width, int64_t dest_height, bool vertical) |
void | GetTiles (int image_width, int image_height, int mip, std::vector< Tile > &tiles) |
CARTA::ImageBounds | GetImageBounds (const Tile &tile, int image_width, int image_height, int mip) |
static std::unordered_map< int, casacore::DataType > | bitpix_types ({{8, casacore::DataType::TpChar}, {16, casacore::DataType::TpShort}, {32, casacore::DataType::TpInt}, {64, casacore::DataType::TpInt64}, {-32, casacore::DataType::TpFloat}, {-64, casacore::DataType::TpDouble}}) |
void | CalcBasicStats (BasicStats< float > &stats, const float *data, const size_t data_size) |
Calculate basic stats from a float vector using BasicStatsCalculator. | |
Histogram | CalcHistogram (int num_bins, const HistogramBounds &bounds, const float *data, const size_t data_size) |
Calculate a histogram from a float vector using Histogram. | |
bool | CalcStatsValues (std::map< CARTA::StatsType, std::vector< double > > &stats_values, const std::vector< CARTA::StatsType > &requested_stats, const casacore::ImageInterface< float > &image, bool per_channel=true) |
Calculate statistics for an image or a region applied to an image. | |
void | GetPositionStats (const casacore::ImageInterface< float > &image, casacore::ImageStatistics< float > image_stats, CARTA::StatsType carta_stats_type, std::vector< double > &dbl_result) |
Calculate statistics related to the image/region position. | |
bool | ComputeFluxDensity (const casacore::ImageInterface< float > &image, casacore::ImageStatistics< float > image_stats, std::vector< double > &result) |
Calculate flux density statistics for an image or a region applied to an image. | |
bool | GetBeamArea (const casacore::ImageInterface< float > &image, const casacore::String unit, double &beam_area) |
Get the area of the beam in the given unit for an image or a region applied to an image. | |
template<class T > | |
void | applyOptionalArgument (T &val, const string &argument_name, const cxxopts::ParseResult &results) |
void | TrimSpaces (string &str) |
std::unique_ptr< Column > | ColumnFromFitsType (int type, const string &col_name) |
template<class T > | |
T | clamp (T val, const T &min_val, const T &max_val) |
Variables | |
static std::unordered_map< CARTA::FileType, string > | FileTypeString |
const std::string | SUCCESS_STRING = json({{"success", true}}).dump() |
const std::unordered_set< std::string > | OBJECT_TYPES = {"layout", "snippet", "workspace"} |
static const std::unordered_map< std::string, std::string > | MimeTypes |
static std::unordered_map< CARTA::StatsType, casacore::LatticeStatsBase::StatisticsTypes > | carta_stats_to_casacore |
Functions to calculate image and region statistics and histograms. | |
const uint16_t | ICD_VERSION = 30 |
typedef const std::function<void(double, double, const std::vector<float>&, const std::vector<int32_t>&)> carta::ContourCallback |
using carta::HistogramBounds = typedef Bounds<double> |
typedef std::vector<int64_t> carta::IndexList |
typedef uWS::HttpRequest carta::Req |
typedef uWS::HttpResponse<false> carta::Res |
typedef std::function<bool(int&, uint32_t&, std::string&, std::string&, std::string&, bool&, std::string&, ScriptingResponseCallback, ScriptingSessionClosedCallback)> carta::ScriptingRequestHandler |
typedef std::function<void(const bool&, const std::string&, const std::string&)> carta::ScriptingResponseCallback |
typedef std::function<void()> carta::ScriptingSessionClosedCallback |
typedef std::shared_ptr< std::vector< float > > carta::TilePtr |
enum carta::Edge |
void carta::applyOptionalArgument | ( | T & | val, |
const string & | argument_name, | ||
const cxxopts::ParseResult & | results | ||
) |
|
static |
bool carta::BlockSmooth | ( | const float * | src_data, |
float * | dest_data, | ||
int64_t | src_width, | ||
int64_t | src_height, | ||
int64_t | dest_width, | ||
int64_t | dest_height, | ||
int64_t | x_offset, | ||
int64_t | y_offset, | ||
int | smoothing_factor | ||
) |
bool carta::BlockSmoothScalar | ( | const float * | src_data, |
float * | dest_data, | ||
int64_t | src_width, | ||
int64_t | src_height, | ||
int64_t | dest_width, | ||
int64_t | dest_height, | ||
int64_t | x_offset, | ||
int64_t | y_offset, | ||
int | smoothing_factor | ||
) |
bool carta::BlockSmoothSSE | ( | const float * | src_data, |
float * | dest_data, | ||
int64_t | src_width, | ||
int64_t | src_height, | ||
int64_t | dest_width, | ||
int64_t | dest_height, | ||
int64_t | x_offset, | ||
int64_t | y_offset, | ||
int | smoothing_factor | ||
) |
void carta::CalcBasicStats | ( | BasicStats< float > & | stats, |
const float * | data, | ||
const size_t | data_size | ||
) |
Calculate basic stats from a float vector using BasicStatsCalculator.
stats | The results returned in a BasicStats struct |
data | The pointer to the float vector |
data_size | The size of the float vector |
Histogram carta::CalcHistogram | ( | int | num_bins, |
const HistogramBounds & | bounds, | ||
const float * | data, | ||
const size_t | data_size | ||
) |
Calculate a histogram from a float vector using Histogram.
num_bins | The number of bins for the histogram |
bounds | The min and max for the histogram in a HistogramBounds struct |
data | The pointer to the float vector |
data_size | The size of the float vector |
bool carta::CalcStatsValues | ( | std::map< CARTA::StatsType, std::vector< double > > & | stats_values, |
const std::vector< CARTA::StatsType > & | requested_stats, | ||
const casacore::ImageInterface< float > & | image, | ||
bool | per_channel = true |
||
) |
Calculate statistics for an image or a region applied to an image.
stats_values | Map to return results by StatsType |
requested_stats | Vector of statistics type to calculate |
image | The image or region applied to an image (casacore::SubImage) |
per_channel | Whether to calculate statistics per channel plane or single stats for the entire image |
Some statistics are calculated using the functions below, while others use casacore::ImageStatistics.
T carta::clamp | ( | T | val, |
const T & | min_val, | ||
const T & | max_val | ||
) |
std::unique_ptr< Column > carta::ColumnFromFitsType | ( | int | type, |
const string & | col_name | ||
) |
int carta::Compress | ( | std::vector< float > & | array, |
size_t | offset, | ||
std::vector< char > & | compression_buffer, | ||
size_t & | compressed_size, | ||
uint32_t | nx, | ||
uint32_t | ny, | ||
uint32_t | precision | ||
) |
int carta::Compress | ( | std::vector< float > & | array, |
size_t | offset, | ||
std::vector< char > & | compression_buffer, | ||
std::size_t & | compressed_size, | ||
uint32_t | nx, | ||
uint32_t | ny, | ||
uint32_t | precision | ||
) |
bool carta::ComputeFluxDensity | ( | const casacore::ImageInterface< float > & | image, |
casacore::ImageStatistics< float > | image_stats, | ||
std::vector< double > & | result | ||
) |
Calculate flux density statistics for an image or a region applied to an image.
image | The image or region applied to an image (casacore::SubImage) |
image_stats | The casacore::ImageStatistics object for the image |
result | Double vector to return the flux density result |
Flux density calculation fails when image unit is not compatible or when the unit is per beam but no beam is defined. ImageStatistics is used to retrieve the sum. GetBeamArea is called when the image unit is per beam.
int carta::Decompress | ( | std::vector< float > & | array, |
std::vector< char > & | compression_buffer, | ||
int | nx, | ||
int | ny, | ||
int | precision | ||
) |
void carta::EncodeIntegers | ( | std::vector< int32_t > & | array, |
bool | strided | ||
) |
bool carta::GaussianSmooth | ( | const float * | src_data, |
float * | dest_data, | ||
int64_t | src_width, | ||
int64_t | src_height, | ||
int64_t | dest_width, | ||
int64_t | dest_height, | ||
int | smoothing_factor | ||
) |
bool carta::GetBeamArea | ( | const casacore::ImageInterface< float > & | image, |
const casacore::String | unit, | ||
double & | beam_area | ||
) |
Get the area of the beam in the given unit for an image or a region applied to an image.
image | The image or region applied to an image (casacore::SubImage) |
unit | The unit to use for the area calculation, based on the image unit |
beam_area | The result of the calculation |
The beam area calculation fails when the image has no beam. casacore::ImageInfo is used to get the area of the beam.
CARTA::ImageBounds carta::GetImageBounds | ( | const Tile & | tile, |
int | image_width, | ||
int | image_height, | ||
int | mip | ||
) |
std::vector< int32_t > carta::GetNanEncodingsBlock | ( | std::vector< float > & | array, |
int | offset, | ||
int | w, | ||
int | h | ||
) |
std::vector< int32_t > carta::GetNanEncodingsSimple | ( | std::vector< float > & | array, |
int | offset, | ||
int | length | ||
) |
void carta::GetPositionStats | ( | const casacore::ImageInterface< float > & | image, |
casacore::ImageStatistics< float > | image_stats, | ||
CARTA::StatsType | carta_stats_type, | ||
std::vector< double > & | dbl_result | ||
) |
Calculate statistics related to the image/region position.
image | The image or region applied to an image (casacore::SubImage) |
image_stats | The casacore::ImageStatistics object for the image |
carta_stats_type | The position statistics type to calculate |
dbl_result | Double vector to return the statistics result |
The casacore::Slicer defining the image bounds is used to determine Blc and Trc. ImageStatistics is used to retrieve the minimum and maximum position.
void carta::GetTiles | ( | int | image_width, |
int | image_height, | ||
int | mip, | ||
std::vector< Tile > & | tiles | ||
) |
|
inlinestatic |
void carta::MakeKernel | ( | std::vector< float > & | kernel, |
double | sigma | ||
) |
void carta::MakeKernel | ( | vector< float > & | kernel, |
double | sigma | ||
) |
void carta::NearestNeighbor | ( | const float * | src_data, |
float * | dest_data, | ||
int64_t | src_width, | ||
int64_t | dest_width, | ||
int64_t | dest_height, | ||
int64_t | x_offset, | ||
int64_t | y_offset, | ||
int | smoothing_factor | ||
) |
double carta::NormPdf | ( | double | x, |
double | sigma | ||
) |
void carta::RoundAndEncodeVertices | ( | const std::vector< float > & | array, |
std::vector< int32_t > & | dest, | ||
float | rounding_factor | ||
) |
bool carta::RunKernel | ( | const std::vector< float > & | kernel, |
const float * | src_data, | ||
float * | dest_data, | ||
int64_t | src_width, | ||
int64_t | src_height, | ||
int64_t | dest_width, | ||
int64_t | dest_height, | ||
bool | vertical | ||
) |
bool carta::RunKernel | ( | const vector< float > & | kernel, |
const float * | src_data, | ||
float * | dest_data, | ||
const int64_t | src_width, | ||
const int64_t | src_height, | ||
const int64_t | dest_width, | ||
const int64_t | dest_height, | ||
const bool | vertical | ||
) |
void carta::TraceContourLevel | ( | float * | image, |
int64_t | width, | ||
int64_t | height, | ||
double | scale, | ||
double | offset, | ||
double | level, | ||
std::vector< double > & | vertex_data, | ||
std::vector< int32_t > & | indices | ||
) |
void carta::TraceContours | ( | float * | image, |
int64_t | width, | ||
int64_t | height, | ||
double | scale, | ||
double | offset, | ||
const std::vector< double > & | levels, | ||
std::vector< std::vector< float > > & | vertex_data, | ||
std::vector< std::vector< int32_t > > & | index_data, | ||
int | chunk_size, | ||
ContourCallback & | partial_callback | ||
) |
void carta::TraceLevel | ( | const float * | image, |
int64_t | width, | ||
int64_t | height, | ||
double | scale, | ||
double | offset, | ||
double | level, | ||
vector< float > & | vertices, | ||
vector< int32_t > & | indices, | ||
int | chunk_size, | ||
ContourCallback & | partial_callback | ||
) |
void carta::TraceSegment | ( | const float * | image, |
std::vector< bool > & | visited, | ||
int64_t | width, | ||
int64_t | height, | ||
double | scale, | ||
double | offset, | ||
double | level, | ||
int | x_cell, | ||
int | y_cell, | ||
int | side, | ||
vector< float > & | vertices | ||
) |
void carta::TrimSpaces | ( | string & | str | ) |
|
static |
Functions to calculate image and region statistics and histograms.
These function are used to calculate basic statistics for histograms, per-channel image and region statistics for Z profiles, and per-plane image and region statistics.
This map is used to convert the CARTA StatsType enum to the casacore StatisticsTypes enum
|
static |
const uint16_t carta::ICD_VERSION = 30 |
|
static |
const std::unordered_set<std::string> carta::OBJECT_TYPES = {"layout", "snippet", "workspace"} |
const std::string carta::SUCCESS_STRING = json({{"success", true}}).dump() |