Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/nyx/abs_tile_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ class AbstractTileLoader
/// @param level Level asked [default 0]
/// @return Number tiles in height for a level
[[nodiscard]] size_t numberTileHeight(size_t level = 0) const {
return (size_t) std::ceil((double) (fullHeight(level)) / tileHeight(level));
return static_cast<size_t>(std::ceil(static_cast<double>((fullHeight(level)) )/ tileHeight(level)));
}
/// @brief Number tiles in width accessor for a level
/// @param level Level asked [default 0]
/// @return Number tiles in width for a level
[[nodiscard]] size_t numberTileWidth(size_t level = 0) const {
return (size_t) std::ceil((double) (fullWidth(level)) / tileWidth(level));
return static_cast<size_t>(std::ceil(static_cast<double>((fullWidth(level)) )/ tileWidth(level)));
}

/// @brief Number tiles in depth accessor for a level
/// @param level Level asked [default 0]
/// @return Number tiles in depth for a level
[[nodiscard]] size_t numberTileDepth(size_t level = 0) const {
return (size_t) std::ceil((double) (fullDepth(level)) / tileDepth(level));
return static_cast<size_t>(std::ceil(static_cast<double>((fullDepth(level)) )/ tileDepth(level)));
}
};
12 changes: 6 additions & 6 deletions src/nyx/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@
using_moments = true;

// moments / real intensities
OKDETL(allocate_on_device((void**)realintens, sizeof(RealPixIntens) * batch_roi_cloud_len), "allocate_on_device(moments1)");
OKDETL(allocate_on_device(reinterpret_cast<void**>(realintens), sizeof(RealPixIntens) * batch_roi_cloud_len), "allocate_on_device(moments1)");

// moments / pre-reduce
OKDETL(allocate_on_device((void**)prereduce, sizeof(double) * batch_roi_cloud_len * 16), "allocate_on_device(moments2)"); // 16 is the max number of simultaneous totals calculated by a kernel, e.g. RM00-33
OKDETL(allocate_on_device(reinterpret_cast<void**>(prereduce), sizeof(double) * batch_roi_cloud_len * 16), "allocate_on_device(moments2)"); // 16 is the max number of simultaneous totals calculated by a kernel, e.g. RM00-33

// moments / intermediate
OKDETL(intermediate.alloc(GpusideState::__COUNT__, batch_len), "allocate_on_device(moments3)");

// moments / CUB DeviceReduce's temp buffer
OKDETL(devicereduce_evaluate_buffer_szb(devicereduce_buf_szb, batch_roi_cloud_len), "allocate_on_device(moments4)");
OKDETL(allocate_on_device((void**)devicereduce_buf, devicereduce_buf_szb), "allocate_on_device(moments5)");
OKDETL(allocate_on_device(reinterpret_cast<void**>(devicereduce_buf), devicereduce_buf_szb), "allocate_on_device(moments5)");
}

// erosion / image matrices 1 and 2
Expand All @@ -214,9 +214,9 @@

// imat1 is shared by erosion and Gabor
if (!*imat1)
OKDETL(allocate_on_device((void**)imat1, sizeof(imat1[0]) * roi_w * roi_h), "allocate_on_device(eros1)");
OKDETL(allocate_on_device(reinterpret_cast<void**>(imat1), sizeof(imat1[0]) * roi_w * roi_h), "allocate_on_device(eros1)");

OKDETL(allocate_on_device((void**)imat2, sizeof(imat2[0]) * roi_w * roi_h), "allocate_on_device(eros2)");
OKDETL(allocate_on_device(reinterpret_cast<void**>(imat2), sizeof(imat2[0]) * roi_w * roi_h), "allocate_on_device(eros2)");
}

// Gabor
Expand All @@ -227,7 +227,7 @@

// imat1 is shared by erosion and Gabor
if (!*imat1)
OKDETL(allocate_on_device((void**)imat1, sizeof(imat1[0]) * roi_w * roi_h), "allocate_on_device(gabor)");
OKDETL(allocate_on_device(reinterpret_cast<void**>(imat1), sizeof(imat1[0]) * roi_w * roi_h), "allocate_on_device(gabor)");

size_t gabTotlen = (roi_w + gabor_ker_side - 1) * (roi_h + gabor_ker_side - 1) * n_gabFilters;
OKDETL(gabor_linear_image.alloc(gabTotlen, 1), "gabor_linear_image.alloc()");
Expand Down
6 changes: 3 additions & 3 deletions src/nyx/common_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Statistics ComputeCommonStatistics2 (std::vector<double> & Data)
output.stdev = sqrt(sumSqrd / Data.size());

//Make a Histogram
int intMax = (int)ceil(output.max);
int intMin = (int)floor(output.min);
int intMax = static_cast<int>(ceil(output.max));
int intMin = static_cast<int>(floor(output.min));
int binCounts = intMax - intMin + 1;

std::vector<int> histBins(binCounts, 0); //--Avoid pointers-- int* histBins = new int[binCounts];

for (int i = 0; i < binCounts; ++i) histBins[i] = 0;
for (int i = 0; i < Data.size(); i++) ++histBins[(int)Data[i] - intMin];
for (int i = 0; i < Data.size(); i++) ++histBins[static_cast<int>(Data[i] )- intMin];

double MaxValue = 0;
int maxBinIndex = -1;
Expand Down
94 changes: 47 additions & 47 deletions src/nyx/env_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ bool Environment::expand_2D_featuregroup (const std::string & s)
enable = false;
}

if ((Fgroup2D)fgcode == Fgroup2D::FG2_ALL)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_ALL)
{
// enable just the 2D part of the feature set
for (int i = (int) Nyxus::Feature2D::_FIRST_; i < (int) Nyxus::Feature2D::_COUNT_; i++)
for (int i = static_cast<int>(Nyxus::Feature2D::_FIRST_); i < static_cast<int>(Nyxus::Feature2D::_COUNT_); i++)
theFeatureSet.enableFeature (i);
return true;
}

if ((Fgroup2D)fgcode == Fgroup2D::FG2_WHOLESLIDE)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_WHOLESLIDE)
{
theFeatureSet.enableFeatures (ContourFeature::featureset, enable);
theFeatureSet.enableFeatures (PixelIntensityFeatures::featureset, enable);
Expand All @@ -233,25 +233,25 @@ bool Environment::expand_2D_featuregroup (const std::string & s)
return true;
}

if ((Fgroup2D) fgcode == Fgroup2D::FG2_NEIG)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_NEIG)
{
theFeatureSet.enableFeatures (NeighborsFeature::featureset, enable);
return true;
}

if ((Fgroup2D) fgcode == Fgroup2D::FG2_INTENSITY)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_INTENSITY)
{
theFeatureSet.enableFeatures (PixelIntensityFeatures::featureset, enable);
return true;
}
if ((Fgroup2D) fgcode == Fgroup2D::FG2_IH)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_IH)
{
// IBSI intensity-histogram family. Requested here; if IBSI mode is off it
// gets stripped at the end of expand_featuregroups() (available only in IBSI mode).
theFeatureSet.enableFeatures (IntensityHistogramFeatures::featureset, enable);
return true;
}
if ((Fgroup2D) fgcode == Fgroup2D::FG2_MORPHOLOGY)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_MORPHOLOGY)
{
theFeatureSet.enableFeatures (BasicMorphologyFeatures::featureset, enable);
theFeatureSet.enableFeatures (EnclosingInscribingCircumscribingCircleFeature::featureset, enable);
Expand All @@ -272,61 +272,61 @@ bool Environment::expand_2D_featuregroup (const std::string & s)

return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_BASIC_MORPHOLOGY)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_BASIC_MORPHOLOGY)
{
theFeatureSet.enableFeatures (BasicMorphologyFeatures::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_GLCM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GLCM)
{
theFeatureSet.enableFeatures (GLCMFeature::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_GLRLM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GLRLM)
{
theFeatureSet.enableFeatures (GLRLMFeature::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_GLDZM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GLDZM)
{
theFeatureSet.enableFeatures (GLDZMFeature::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_GLSZM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GLSZM)
{
theFeatureSet.enableFeatures (GLSZMFeature::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_GLDM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GLDM)
{
theFeatureSet.enableFeatures(GLDMFeature::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_NGLDM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_NGLDM)
{
theFeatureSet.enableFeatures (NGLDMfeature::featureset, enable);
return true;
}
if ((Fgroup2D)fgcode == Fgroup2D::FG2_NGTDM)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_NGTDM)
{
theFeatureSet.enableFeatures (NGTDMFeature::featureset, enable);
return true;
}

if ((Fgroup2D)fgcode == Fgroup2D::FG2_GEOMOMENTS)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GEOMOMENTS)
{
theFeatureSet.enableFeatures (Smoms2D_feature::featureset, enable);
theFeatureSet.enableFeatures (Imoms2D_feature::featureset, enable);
return true;
}

if ((Fgroup2D)fgcode == Fgroup2D::FG2_GEOMOMENTS_I)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GEOMOMENTS_I)
{
theFeatureSet.enableFeatures (Imoms2D_feature::featureset, enable);
return true;
}

if ((Fgroup2D)fgcode == Fgroup2D::FG2_GEOMOMENTS_S)
if (static_cast<Fgroup2D>(fgcode )== Fgroup2D::FG2_GEOMOMENTS_S)
{
theFeatureSet.enableFeatures (Smoms2D_feature::featureset, enable);
return true;
Expand All @@ -353,7 +353,7 @@ bool Environment::expand_3D_featuregroup (const std::string& s)
}

// mutually exclusive groups:
if ((Fgroup3D)fgcode == Fgroup3D::FG3_ALL)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_ALL)
{
theFeatureSet.enableFeatures (D3_VoxelIntensityFeatures::featureset, enable);
theFeatureSet.enableFeatures (D3_SurfaceFeature::featureset, enable);
Expand All @@ -368,19 +368,19 @@ bool Environment::expand_3D_featuregroup (const std::string& s)
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_INTENSITY)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_INTENSITY)
{
theFeatureSet.enableFeatures (D3_VoxelIntensityFeatures::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_MORPHOLOGY)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_MORPHOLOGY)
{
theFeatureSet.enableFeatures (D3_SurfaceFeature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_TEXTURE)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_TEXTURE)
{
theFeatureSet.enableFeatures (D3_GLCM_feature::featureset, enable);
theFeatureSet.enableFeatures (D3_GLDM_feature::featureset, enable);
Expand All @@ -392,43 +392,43 @@ bool Environment::expand_3D_featuregroup (const std::string& s)
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLCM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_GLCM)
{
theFeatureSet.enableFeatures (D3_GLCM_feature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLDM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_GLDM)
{
theFeatureSet.enableFeatures (D3_GLDM_feature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_NGLDM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_NGLDM)
{
theFeatureSet.enableFeatures (D3_NGLDM_feature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_NGTDM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_NGTDM)
{
theFeatureSet.enableFeatures (D3_NGTDM_feature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLDZM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_GLDZM)
{
theFeatureSet.enableFeatures (D3_GLDZM_feature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLSZM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_GLSZM)
{
theFeatureSet.enableFeatures (D3_GLSZM_feature::featureset, enable);
return true;
}

if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLRLM)
if (static_cast<Fgroup3D>(fgcode )== Fgroup3D::FG3_GLRLM)
{
theFeatureSet.enableFeatures (D3_GLRLM_feature::featureset, enable);
return true;
Expand Down Expand Up @@ -713,26 +713,26 @@ void Environment::compile_feature_settings()
{
auto& s = wrapd_s.get();
s.clear();
s.resize((int)NyxSetting::__COUNT__);
s[(int)NyxSetting::SOFTNAN].rval = resultOptions.noval();
s[(int)NyxSetting::TINY].rval = resultOptions.tiny();
s[(int)NyxSetting::SINGLEROI].bval = singleROI;
s[(int)NyxSetting::GREYDEPTH].ival = get_coarse_gray_depth();
s[(int)NyxSetting::PIXELSIZEUM].rval = pixelSizeUm;
s[(int)NyxSetting::PIXELDISTANCE].ival = get_pixel_distance();
s[(int)NyxSetting::USEGPU].bval = using_gpu();
s[(int)NyxSetting::VERBOSLVL].ival = get_verbosity_level();
s[(int)NyxSetting::IBSI].bval = ibsi_compliance;
s.resize(static_cast<int>(NyxSetting::__COUNT__));
s[static_cast<int>(NyxSetting::SOFTNAN)].rval = resultOptions.noval();
s[static_cast<int>(NyxSetting::TINY)].rval = resultOptions.tiny();
s[static_cast<int>(NyxSetting::SINGLEROI)].bval = singleROI;
s[static_cast<int>(NyxSetting::GREYDEPTH)].ival = get_coarse_gray_depth();
s[static_cast<int>(NyxSetting::PIXELSIZEUM)].rval = pixelSizeUm;
s[static_cast<int>(NyxSetting::PIXELDISTANCE)].ival = get_pixel_distance();
s[static_cast<int>(NyxSetting::USEGPU)].bval = using_gpu();
s[static_cast<int>(NyxSetting::VERBOSLVL)].ival = get_verbosity_level();
s[static_cast<int>(NyxSetting::IBSI)].bval = ibsi_compliance;
// GLCM-specific defaults (otherwise zero-initialised). GLCM_OFFSET=0 would make
// dx=dy=0 -> every pixel co-occurs with itself -> degenerate diagonal matrix
// (CONTRAST=0). Default the co-occurrence distance to 1 (IBSI delta=1).
s[(int)NyxSetting::GLCM_OFFSET].ival = 1;
s[(int)NyxSetting::GLCM_GREYDEPTH].ival = get_coarse_gray_depth();
s[(int)NyxSetting::GLCM_NUMANG].ival = (int)GLCMFeature::angles.size();
s[(int)NyxSetting::FPIMG_TARGET_DR].rval = fpimageOptions.target_dyn_range();
s[(int)NyxSetting::FPIMG_MIN].rval = fpimageOptions.min_intensity();
s[(int)NyxSetting::FPIMG_MAX].rval = fpimageOptions.max_intensity();
s[(int)NyxSetting::FPIMG_ACTIVE].bval = ! fpimageOptions.empty();
s[static_cast<int>(NyxSetting::GLCM_OFFSET)].ival = 1;
s[static_cast<int>(NyxSetting::GLCM_GREYDEPTH)].ival = get_coarse_gray_depth();
s[static_cast<int>(NyxSetting::GLCM_NUMANG)].ival = static_cast<int>(GLCMFeature::angles.size());
s[static_cast<int>(NyxSetting::FPIMG_TARGET_DR)].rval = fpimageOptions.target_dyn_range();
s[static_cast<int>(NyxSetting::FPIMG_MIN)].rval = fpimageOptions.min_intensity();
s[static_cast<int>(NyxSetting::FPIMG_MAX)].rval = fpimageOptions.max_intensity();
s[static_cast<int>(NyxSetting::FPIMG_ACTIVE)].bval = ! fpimageOptions.empty();
}
}

Expand All @@ -742,7 +742,7 @@ void Environment::refresh_feature_settings_singleroi()
{
auto& s = wrapd_s.get();
if (!s.empty())
s[(int)NyxSetting::SINGLEROI].bval = singleROI;
s[static_cast<int>(NyxSetting::SINGLEROI)].bval = singleROI;
}
}

Expand Down
Loading
Loading