Skip to content

Commit

Permalink
Jenkins: Format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Inviwo-Team authored and petersteneteg committed Jan 23, 2025
1 parent 308db9b commit 98cc817
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class IVW_MODULE_COMPUTEUTILS_API VolumeMinMaxGL {
* @param disregardingStatus Indicating whether or not the calculation of the min/max value
* should disregard a certain value range. This is for example handy for volumes where special
* regions are marked with voxel values of INT_MAX or the like.
* * Example: Your data array consists of {0, 1, 2, 3, INT_MAX} and you would like to compute the
* max value. In addition, you know that outliers are marked with a value of INT_MAX so you
* * Example: Your data array consists of {0, 1, 2, 3, INT_MAX} and you would like to compute
* the max value. In addition, you know that outliers are marked with a value of INT_MAX so you
* would like those values to not be considered. In that case, you call
* minmax(myVolume, DisregardingStatus::On,
* vec2{myVolume->dataMap_.dataRange.x, std::numeric_limits<int>::max() - 1});
Expand All @@ -64,7 +64,8 @@ class IVW_MODULE_COMPUTEUTILS_API VolumeMinMaxGL {
* @returns Aggregated min/max values.
*/
dvec2 minmax(std::shared_ptr<const Volume> volume,
DisregardingStatus disregardingStatus = DisregardingStatus::Off, const vec2& range = vec2{0});
DisregardingStatus disregardingStatus = DisregardingStatus::Off,
const vec2& range = vec2{0});

protected:
VolumeReductionGL volumeReductionGL_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class IVW_MODULE_COMPUTEUTILS_API VolumeChannelSplitGLProcessor : public Process
VolumeInport volumeInport_;

VolumeSequenceOutport volumeOutport_;

VolumeChannelSplitGL volumeChannelSplitGl_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ namespace inviwo {
* ![](org.inviwo.VolumeMinMaxGLProcessor.png?classIdentifier=org.inviwo.VolumeMinMaxGLProcessor)
*
* This method calculates min and max values of a volume. If you need min/max per channel you should
* look at VolumeReductionGL. The disregarding status indicates whether or not the calculation of the
* min/max values should disregard a certain value range. This is for example handy for volumes where
* special regions are marked with voxel values of INT_MAX or the like. Example: Your data array
* consists of {0, 1, 2, 3, INT_MAX} and you would like to compute the max value. In addition, you
* know that outliers are marked with a value of INT_MAX so you would like those values to not be
* considered.
* look at VolumeReductionGL. The disregarding status indicates whether or not the calculation of
* the min/max values should disregard a certain value range. This is for example handy for volumes
* where special regions are marked with voxel values of INT_MAX or the like. Example: Your data
* array consists of {0, 1, 2, 3, INT_MAX} and you would like to compute the max value. In addition,
* you know that outliers are marked with a value of INT_MAX so you would like those values to not
* be considered.
*
* ### Inputs
* * __Volume inport__ Input volume.
Expand Down
2 changes: 1 addition & 1 deletion misc/computeutils/src/algorithm/volumechannelsplitgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ std::vector<std::shared_ptr<Volume>> VolumeChannelSplitGL::split(

const auto dimensions = volume->getDimensions();

for (auto i{0};i<4;++i) {
for (auto i{0}; i < 4; ++i) {
shader_.getShaderObject(ShaderType::Compute)
->removeShaderDefine(StrBuffer("CHANNEL {}", i));
}
Expand Down
4 changes: 2 additions & 2 deletions misc/computeutils/src/algorithm/volumeminmaxgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include <inviwo/computeutils/algorithm/volumeminmaxgl.h>

namespace inviwo {
dvec2 VolumeMinMaxGL::minmax(std::shared_ptr<const Volume> volume, DisregardingStatus disregardingStatus,
const vec2& range) {
dvec2 VolumeMinMaxGL::minmax(std::shared_ptr<const Volume> volume,
DisregardingStatus disregardingStatus, const vec2& range) {
const auto min =
volumeReductionGL_.reduce_v(volume, ReductionOperator::Min, disregardingStatus, range);
const auto max =
Expand Down
2 changes: 1 addition & 1 deletion misc/computeutils/src/computeutilsmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace inviwo {

ComputeUtilsModule::ComputeUtilsModule(InviwoApplication* app) : InviwoModule(app, "ComputeUtils") {
ShaderManager::getPtr()->addShaderSearchPath(getPath(ModulePath::GLSL));

registerProcessor<VolumeChannelSplitGLProcessor>();
registerProcessor<VolumeMinMaxGLProcessor>();
registerProcessor<VolumeNormalizationGLProcessor>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace inviwo {
const ProcessorInfo VolumeChannelSplitGLProcessor::processorInfo_{
"org.inviwo.VolumeChannelSplitGLProcessor", // Class identifier
"Volume Channel Split Processor", // Display name
"Volume Operation", // Category
"Volume Operation", // Category
CodeState::Experimental, // Code state
Tags::GL, // Tags
};
Expand All @@ -44,9 +44,7 @@ const ProcessorInfo VolumeChannelSplitGLProcessor::getProcessorInfo() const {
}

VolumeChannelSplitGLProcessor::VolumeChannelSplitGLProcessor()
: Processor()
, volumeInport_("volumeInport")
, volumeOutport_("volumeOutport"){
: Processor(), volumeInport_("volumeInport"), volumeOutport_("volumeOutport") {

addPorts(volumeInport_, volumeOutport_);
}
Expand All @@ -55,7 +53,7 @@ void VolumeChannelSplitGLProcessor::process() {
if (!volumeInport_.hasData() || !volumeInport_.getData()) {
return;
}

volumeOutport_.setData(volumeChannelSplitGl_.split(volumeInport_.getData()));
}

Expand Down
9 changes: 5 additions & 4 deletions misc/computeutils/src/processors/volumeminmaxglprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ namespace inviwo {
// The Class Identifier has to be globally unique. Use a reverse DNS naming scheme
const ProcessorInfo VolumeMinMaxGLProcessor::processorInfo_{
"org.inviwo.VolumeMinMaxGLProcessor", // Class identifier
"Volume Min Max", // Display name
"Volume Operation", // Category
"Volume Min Max", // Display name
"Volume Operation", // Category
CodeState::Experimental, // Code state
"range, minmax", // Tags
};
Expand All @@ -46,8 +46,9 @@ VolumeMinMaxGLProcessor::VolumeMinMaxGLProcessor()
: Processor()
, volumeInport_("volumeInport")
, volumeOutport_("volumeOutport")
, disregardingStatus_("disregardingStatus", "Disregarding status",
{{"off", "Off", DisregardingStatus::Off}, {"on", "On", DisregardingStatus::On}})
, disregardingStatus_(
"disregardingStatus", "Disregarding status",
{{"off", "Off", DisregardingStatus::Off}, {"on", "On", DisregardingStatus::On}})
, disregardingRange_("range", "Range") {

addPorts(volumeInport_, volumeOutport_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace inviwo {
const ProcessorInfo VolumeReductionGLProcessor::processorInfo_{
"org.inviwo.VolumeReductionGLProcessor", // Class identifier
"Volume Reduction", // Display name
"Volume Operation", // Category
"Volume Operation", // Category
CodeState::Experimental, // Code state
Tags::GL, // Tags
};
Expand All @@ -57,7 +57,7 @@ VolumeReductionGLProcessor::VolumeReductionGLProcessor()

void VolumeReductionGLProcessor::process() {
const auto reduced = gpuReduction_.reduce(volumeInport_.getData(), reductionOperator_.get());

volumeOutport_.setData(reduced);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
namespace inviwo {
class IVW_MODULE_FEATURELEVELSETSGL_API ImplicitFunctionTraitProperty : public TraitProperty {
public:
static constexpr std::string_view stub{"// in: <float> point[NUM_VOLUMES]\n//in: <vec2> ranges[NUM_VOLUMES]\n// out: <float> result\nresult = point[0];"};
static constexpr std::string_view stub{
"// in: <float> point[NUM_VOLUMES]\n//in: <vec2> ranges[NUM_VOLUMES]\n// out: <float> "
"result\nresult = point[0];"};

ImplicitFunctionTraitProperty() = delete;
ImplicitFunctionTraitProperty(const ImplicitFunctionTraitProperty& p)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ enum class DistanceMetric { Euclidean, Manhattan, Minkowski, SquaredSum };
* \return Minkowski distance of order n between points a and b
*/
template <typename T>
T minkowskiDistance(const std::vector<T>& a, const std::vector<T>& b,
const T order) {
IVW_ASSERT(a.size() == b.size(),
"Minkowski distance requires equal length vectors");
return std::pow(
std::inner_product(a.begin(), a.end(), b.begin(), T(0), std::plus<>(),
[order](T x, T y) { return std::pow(y - x, order); }),
T(1) / order);
T minkowskiDistance(const std::vector<T>& a, const std::vector<T>& b, const T order) {
IVW_ASSERT(a.size() == b.size(), "Minkowski distance requires equal length vectors");
return std::pow(std::inner_product(a.begin(), a.end(), b.begin(), T(0), std::plus<>(),
[order](T x, T y) { return std::pow(y - x, order); }),
T(1) / order);
}

/**
Expand All @@ -35,7 +32,7 @@ T minkowskiDistance(const std::vector<T>& a, const std::vector<T>& b,
*/
template <typename T>
T manhattanDistance(const std::vector<T>& a, const std::vector<T>& b) {
return minkowskiDistance(a, b, T(1));
return minkowskiDistance(a, b, T(1));
}

/**
Expand All @@ -49,7 +46,7 @@ T manhattanDistance(const std::vector<T>& a, const std::vector<T>& b) {
*/
template <typename T>
T euclideanDistance(const std::vector<T>& a, const std::vector<T>& b) {
return minkowskiDistance(a, b, T(2));
return minkowskiDistance(a, b, T(2));
}

/**
Expand All @@ -63,24 +60,23 @@ T euclideanDistance(const std::vector<T>& a, const std::vector<T>& b) {
*/
template <typename T>
T squaredSumDistance(const std::vector<T>& a, const std::vector<T>& b) {
IVW_ASSERT(a.size() == b.size(),
"Squared sum distance requires equal length vectors");
return std::inner_product(a.begin(), a.end(), b.begin(), T(0), std::plus<>(),
[](T x, T y) { return std::pow(y - x, T(2)); });
IVW_ASSERT(a.size() == b.size(), "Squared sum distance requires equal length vectors");
return std::inner_product(a.begin(), a.end(), b.begin(), T(0), std::plus<>(),
[](T x, T y) { return std::pow(y - x, T(2)); });
}

template <typename T>
T normalizeValue(const T& val, const T& minVal, const T& maxVal) {
if (val >= maxVal) return T(1);
if (val <= minVal) return T(0);
return (val - minVal) / (maxVal - minVal);
if (val >= maxVal) return T(1);
if (val <= minVal) return T(0);
return (val - minVal) / (maxVal - minVal);
}

template <typename T>
T denormalizeValue(const T& val, const T& minVal, const T& maxVal) {
if (val <= T(0)) return minVal;
if (val >= T(1)) return maxVal;
return minVal + val * (maxVal - minVal);
if (val <= T(0)) return minVal;
if (val >= T(1)) return maxVal;
return minVal + val * (maxVal - minVal);
}
} // namespace util
} // namespace inviwo
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace inviwo {
const ProcessorInfo FeatureLevelSetProcessorGL::processorInfo_{
"org.inviwo.FeatureLevelSetProcessorGL", // Class identifier
"Feature Level Sets", // Display name
"Volume Operation", // Category
"Volume Operation", // Category
CodeState::Experimental, // Code state
Tags::GL, // Tags
};
Expand Down Expand Up @@ -618,10 +618,9 @@ void FeatureLevelSetProcessorGL::onWillAddProperty(Property* property, size_t) {
resizeTraitAllocation();
}

//traitProperty->onChange([&, this]() { generateTraitMesh(traitProperty->getIdentifier()); });
// traitProperty->onChange([&, this]() { generateTraitMesh(traitProperty->getIdentifier());
// });
}
}



} // namespace inviwo

0 comments on commit 98cc817

Please sign in to comment.