diff --git a/misc/computeutils/include/inviwo/computeutils/algorithm/volumeminmaxgl.h b/misc/computeutils/include/inviwo/computeutils/algorithm/volumeminmaxgl.h index 79d8ec1cf..195b117f8 100644 --- a/misc/computeutils/include/inviwo/computeutils/algorithm/volumeminmaxgl.h +++ b/misc/computeutils/include/inviwo/computeutils/algorithm/volumeminmaxgl.h @@ -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::max() - 1}); @@ -64,7 +64,8 @@ class IVW_MODULE_COMPUTEUTILS_API VolumeMinMaxGL { * @returns Aggregated min/max values. */ dvec2 minmax(std::shared_ptr volume, - DisregardingStatus disregardingStatus = DisregardingStatus::Off, const vec2& range = vec2{0}); + DisregardingStatus disregardingStatus = DisregardingStatus::Off, + const vec2& range = vec2{0}); protected: VolumeReductionGL volumeReductionGL_; diff --git a/misc/computeutils/include/inviwo/computeutils/processors/volumechannelsplitglprocessor.h b/misc/computeutils/include/inviwo/computeutils/processors/volumechannelsplitglprocessor.h index 413644f00..4cb67e06d 100644 --- a/misc/computeutils/include/inviwo/computeutils/processors/volumechannelsplitglprocessor.h +++ b/misc/computeutils/include/inviwo/computeutils/processors/volumechannelsplitglprocessor.h @@ -62,7 +62,7 @@ class IVW_MODULE_COMPUTEUTILS_API VolumeChannelSplitGLProcessor : public Process VolumeInport volumeInport_; VolumeSequenceOutport volumeOutport_; - + VolumeChannelSplitGL volumeChannelSplitGl_; }; diff --git a/misc/computeutils/include/inviwo/computeutils/processors/volumeminmaxglprocessor.h b/misc/computeutils/include/inviwo/computeutils/processors/volumeminmaxglprocessor.h index 0c2e2ba8e..163d53683 100644 --- a/misc/computeutils/include/inviwo/computeutils/processors/volumeminmaxglprocessor.h +++ b/misc/computeutils/include/inviwo/computeutils/processors/volumeminmaxglprocessor.h @@ -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. diff --git a/misc/computeutils/src/algorithm/volumechannelsplitgl.cpp b/misc/computeutils/src/algorithm/volumechannelsplitgl.cpp index 3d2eee196..127b952dd 100644 --- a/misc/computeutils/src/algorithm/volumechannelsplitgl.cpp +++ b/misc/computeutils/src/algorithm/volumechannelsplitgl.cpp @@ -56,7 +56,7 @@ std::vector> 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)); } diff --git a/misc/computeutils/src/algorithm/volumeminmaxgl.cpp b/misc/computeutils/src/algorithm/volumeminmaxgl.cpp index 7b8300371..9a7d6eeef 100644 --- a/misc/computeutils/src/algorithm/volumeminmaxgl.cpp +++ b/misc/computeutils/src/algorithm/volumeminmaxgl.cpp @@ -30,8 +30,8 @@ #include namespace inviwo { -dvec2 VolumeMinMaxGL::minmax(std::shared_ptr volume, DisregardingStatus disregardingStatus, - const vec2& range) { +dvec2 VolumeMinMaxGL::minmax(std::shared_ptr volume, + DisregardingStatus disregardingStatus, const vec2& range) { const auto min = volumeReductionGL_.reduce_v(volume, ReductionOperator::Min, disregardingStatus, range); const auto max = diff --git a/misc/computeutils/src/computeutilsmodule.cpp b/misc/computeutils/src/computeutilsmodule.cpp index 0325652f6..35d9640aa 100644 --- a/misc/computeutils/src/computeutilsmodule.cpp +++ b/misc/computeutils/src/computeutilsmodule.cpp @@ -39,7 +39,7 @@ namespace inviwo { ComputeUtilsModule::ComputeUtilsModule(InviwoApplication* app) : InviwoModule(app, "ComputeUtils") { ShaderManager::getPtr()->addShaderSearchPath(getPath(ModulePath::GLSL)); - + registerProcessor(); registerProcessor(); registerProcessor(); diff --git a/misc/computeutils/src/processors/volumechannelsplitglprocessor.cpp b/misc/computeutils/src/processors/volumechannelsplitglprocessor.cpp index 2d6f37548..0002d5cb9 100644 --- a/misc/computeutils/src/processors/volumechannelsplitglprocessor.cpp +++ b/misc/computeutils/src/processors/volumechannelsplitglprocessor.cpp @@ -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 }; @@ -44,9 +44,7 @@ const ProcessorInfo VolumeChannelSplitGLProcessor::getProcessorInfo() const { } VolumeChannelSplitGLProcessor::VolumeChannelSplitGLProcessor() - : Processor() - , volumeInport_("volumeInport") - , volumeOutport_("volumeOutport"){ + : Processor(), volumeInport_("volumeInport"), volumeOutport_("volumeOutport") { addPorts(volumeInport_, volumeOutport_); } @@ -55,7 +53,7 @@ void VolumeChannelSplitGLProcessor::process() { if (!volumeInport_.hasData() || !volumeInport_.getData()) { return; } - + volumeOutport_.setData(volumeChannelSplitGl_.split(volumeInport_.getData())); } diff --git a/misc/computeutils/src/processors/volumeminmaxglprocessor.cpp b/misc/computeutils/src/processors/volumeminmaxglprocessor.cpp index 7cbfbb8e7..621e84c34 100644 --- a/misc/computeutils/src/processors/volumeminmaxglprocessor.cpp +++ b/misc/computeutils/src/processors/volumeminmaxglprocessor.cpp @@ -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 }; @@ -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_); diff --git a/misc/computeutils/src/processors/volumereductionglprocessor.cpp b/misc/computeutils/src/processors/volumereductionglprocessor.cpp index ac41dbe3b..ba28d3d3b 100644 --- a/misc/computeutils/src/processors/volumereductionglprocessor.cpp +++ b/misc/computeutils/src/processors/volumereductionglprocessor.cpp @@ -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 }; @@ -57,7 +57,7 @@ VolumeReductionGLProcessor::VolumeReductionGLProcessor() void VolumeReductionGLProcessor::process() { const auto reduced = gpuReduction_.reduce(volumeInport_.getData(), reductionOperator_.get()); - + volumeOutport_.setData(reduced); } diff --git a/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/properties/implicitfunctiontraitproperty.h b/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/properties/implicitfunctiontraitproperty.h index 005b2855e..792fbde76 100644 --- a/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/properties/implicitfunctiontraitproperty.h +++ b/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/properties/implicitfunctiontraitproperty.h @@ -9,7 +9,9 @@ namespace inviwo { class IVW_MODULE_FEATURELEVELSETSGL_API ImplicitFunctionTraitProperty : public TraitProperty { public: - static constexpr std::string_view stub{"// in: point[NUM_VOLUMES]\n//in: ranges[NUM_VOLUMES]\n// out: result\nresult = point[0];"}; + static constexpr std::string_view stub{ + "// in: point[NUM_VOLUMES]\n//in: ranges[NUM_VOLUMES]\n// out: " + "result\nresult = point[0];"}; ImplicitFunctionTraitProperty() = delete; ImplicitFunctionTraitProperty(const ImplicitFunctionTraitProperty& p) diff --git a/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/util/util.h b/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/util/util.h index ead6856d7..35c716e24 100644 --- a/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/util/util.h +++ b/multivis/featurelevelsetsgl/include/inviwo/featurelevelsetsgl/util/util.h @@ -14,14 +14,11 @@ enum class DistanceMetric { Euclidean, Manhattan, Minkowski, SquaredSum }; * \return Minkowski distance of order n between points a and b */ template -T minkowskiDistance(const std::vector& a, const std::vector& 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& a, const std::vector& 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); } /** @@ -35,7 +32,7 @@ T minkowskiDistance(const std::vector& a, const std::vector& b, */ template T manhattanDistance(const std::vector& a, const std::vector& b) { - return minkowskiDistance(a, b, T(1)); + return minkowskiDistance(a, b, T(1)); } /** @@ -49,7 +46,7 @@ T manhattanDistance(const std::vector& a, const std::vector& b) { */ template T euclideanDistance(const std::vector& a, const std::vector& b) { - return minkowskiDistance(a, b, T(2)); + return minkowskiDistance(a, b, T(2)); } /** @@ -63,24 +60,23 @@ T euclideanDistance(const std::vector& a, const std::vector& b) { */ template T squaredSumDistance(const std::vector& a, const std::vector& 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 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 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 \ No newline at end of file diff --git a/multivis/featurelevelsetsgl/src/processors/featurelevelsetprocessorgl.cpp b/multivis/featurelevelsetsgl/src/processors/featurelevelsetprocessorgl.cpp index 7488ef84e..92add717c 100644 --- a/multivis/featurelevelsetsgl/src/processors/featurelevelsetprocessorgl.cpp +++ b/multivis/featurelevelsetsgl/src/processors/featurelevelsetprocessorgl.cpp @@ -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 }; @@ -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