Field3D
MinMaxUtil.h File Reference

Contains MIP-related utility functions. More...

#include <vector>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include "MIPUtil.h"
#include "ns.h"

Go to the source code of this file.

Functions

template<typename MIPField_T >
FIELD3D_NAMESPACE_OPEN std::pair< typename MIPField_T::Ptr, typename MIPField_T::Ptr > makeMinMax (const typename MIPField_T::NestedType &base, const float resMult, const size_t numThreads)
 Constructs a min/max MIP representation of the given field.
 
template<typename MIPField_T >
std::pair< typename MIPField_T::Ptr, typename MIPField_T::Ptr > makeMinMax (const typename MIPField_T::NestedType &base, const float resMult, const size_t numThreads)
 Constructs a min/max MIP representation of the given field.
 

Variables

const chark_maxSuffix
 The standard 'max' suffix - "_max".
 
const chark_minSuffix
 The standard 'min' suffix - "_min".
 

Detailed Description

Contains MIP-related utility functions.

Definition in file MinMaxUtil.h.

Function Documentation

◆ makeMinMax() [1/2]

template<typename MIPField_T >
FIELD3D_NAMESPACE_OPEN std::pair< typename MIPField_T::Ptr, typename MIPField_T::Ptr > makeMinMax ( const typename MIPField_T::NestedType & base,
const float resMult,
const size_t numThreads )

Constructs a min/max MIP representation of the given field.

Definition at line 88 of file MinMaxUtil.h.

90{
91 typedef typename MIPField_T::Ptr MipPtr;
92 typedef typename MIPField_T::NestedType Field;
93 typedef typename MIPField_T::NestedType::Ptr FieldPtr;
94
95 // Storage for results
96 std::pair<MipPtr, MipPtr> result;
97
98 // First, downsample the field into a min and max representation ---
99
100 V3i srcRes = base.dataWindow().size() + Field3D::V3i(1);
101 V3i res = V3f(srcRes) * std::min(1.0f, resMult);
102
103 // Corner case handling
104 res.x = std::max(res.x, 2);
105 res.y = std::max(res.y, 2);
106 res.z = std::max(res.z, 2);
107
108 // Storage for min/max fields
109 FieldPtr minSrc(new Field);
110 FieldPtr maxSrc(new Field);
111
112 // Resample
113 resample(base, *minSrc, res, MinFilter());
114 resample(base, *maxSrc, res, MaxFilter());
115
116 // Second, generate MIP representations ---
117
120
121 return result;
122}
FIELD3D_NAMESPACE_OPEN bool resample(const Field_T &src, Field_T &tgt, const V3i &newRes, const FilterOp_T &filter)
Resamples the source field into the target field, such that the new data window is @dataWindow.
Definition Resample.h:560
Imath::V3i V3i
Definition SpiMathLib.h:71
Imath::V3f V3f
Definition SpiMathLib.h:73
#define FIELD3D_MTX_T
Definition StdMathLib.h:99
const Box3i & dataWindow() const
Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field su...
Definition Field.h:253
Definition Field.h:390

References FieldRes::dataWindow(), FIELD3D_MTX_T, and resample().

◆ makeMinMax() [2/2]

template<typename MIPField_T >
std::pair< typename MIPField_T::Ptr, typename MIPField_T::Ptr > makeMinMax ( const typename MIPField_T::NestedType & base,
const float resMult,
const size_t numThreads )

Constructs a min/max MIP representation of the given field.

Definition at line 88 of file MinMaxUtil.h.

90{
91 typedef typename MIPField_T::Ptr MipPtr;
92 typedef typename MIPField_T::NestedType Field;
93 typedef typename MIPField_T::NestedType::Ptr FieldPtr;
94
95 // Storage for results
96 std::pair<MipPtr, MipPtr> result;
97
98 // First, downsample the field into a min and max representation ---
99
100 V3i srcRes = base.dataWindow().size() + Field3D::V3i(1);
101 V3i res = V3f(srcRes) * std::min(1.0f, resMult);
102
103 // Corner case handling
104 res.x = std::max(res.x, 2);
105 res.y = std::max(res.y, 2);
106 res.z = std::max(res.z, 2);
107
108 // Storage for min/max fields
109 FieldPtr minSrc(new Field);
110 FieldPtr maxSrc(new Field);
111
112 // Resample
113 resample(base, *minSrc, res, MinFilter());
114 resample(base, *maxSrc, res, MaxFilter());
115
116 // Second, generate MIP representations ---
117
120
121 return result;
122}

References FieldRes::dataWindow(), FIELD3D_MTX_T, and resample().

Variable Documentation

◆ k_minSuffix

const char* k_minSuffix
extern

The standard 'min' suffix - "_min".

Definition at line 55 of file MinMaxUtil.cpp.

◆ k_maxSuffix

const char* k_maxSuffix
extern

The standard 'max' suffix - "_max".

Definition at line 56 of file MinMaxUtil.cpp.