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>
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>
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.

## Variables

const char * | k_maxSuffix
| The standard 'max' suffix - "_max".
const char * | k_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.

{
typedef typename MIPField_T::Ptr MipPtr;
typedef typename MIPField_T::NestedType Field;
typedef typename MIPField_T::NestedType::Ptr FieldPtr;
// Storage for results
std::pair<MipPtr, MipPtr> result;
// First, downsample the field into a min and max representation ---
V3i srcRes = base.dataWindow().size() + Field3D::V3i(1);
V3i res = V3f(srcRes) * std::min(1.0f, resMult);
// Corner case handling
res.x = std::max(res.x, 2);
res.y = std::max(res.y, 2);
res.z = std::max(res.z, 2);
// Storage for min/max fields
FieldPtr minSrc(new Field);
FieldPtr maxSrc(new Field);
// Resample
resample(base, *minSrc, res, MinFilter());
resample(base, *maxSrc, res, MaxFilter());
// Second, generate MIP representations ---
result.first = makeMIP<MIPField_T, MinFilter>(*minSrc, 2, numThreads);
result.second = makeMIP<MIPField_T, MaxFilter>(*maxSrc, 2, numThreads);
return result;
}
makeMIP
MIPField_T::Ptr makeMIP(const typename MIPField_T::NestedType &base, const int minSize, const V3i &offset, const size_t numThreads)
Constructs a MIP representation of the given field, with optional offset vector. The offset vector in...
Definition MIPUtil.h:490
resample
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
V3i
Imath::V3i V3i
Definition SpiMathLib.h:71
V3f
Imath::V3f V3f
Definition SpiMathLib.h:73
Field
Definition Field.h:390
MaxFilter
Definition Resample.h:210
MinFilter
Definition Resample.h:154

References makeMIP(), 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.

{
typedef typename MIPField_T::Ptr MipPtr;
typedef typename MIPField_T::NestedType Field;
typedef typename MIPField_T::NestedType::Ptr FieldPtr;
// Storage for results
std::pair<MipPtr, MipPtr> result;
// First, downsample the field into a min and max representation ---
V3i srcRes = base.dataWindow().size() + Field3D::V3i(1);
V3i res = V3f(srcRes) * std::min(1.0f, resMult);
// Corner case handling
res.x = std::max(res.x, 2);
res.y = std::max(res.y, 2);
res.z = std::max(res.z, 2);
// Storage for min/max fields
FieldPtr minSrc(new Field);
FieldPtr maxSrc(new Field);
// Resample
resample(base, *minSrc, res, MinFilter());
resample(base, *maxSrc, res, MaxFilter());
// Second, generate MIP representations ---
result.first = makeMIP<MIPField_T, MinFilter>(*minSrc, 2, numThreads);
result.second = makeMIP<MIPField_T, MaxFilter>(*maxSrc, 2, numThreads);
return result;
}

References makeMIP(), 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.