MIPField.h
Go to the documentation of this file.
//----------------------------------------------------------------------------//
/*
* Copyright (c) 2009 Sony Pictures Imageworks Inc
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution. Neither the name of Sony Pictures Imageworks nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
#ifndef _INCLUDED_MIPField_H_
#define _INCLUDED_MIPField_H_
#include <vector>
#include <boost/lexical_cast.hpp>
#include <boost/thread/mutex.hpp>
#include "EmptyField.h"
#include "MIPBase.h"
#include "MIPInterp.h"
#include "MIPUtil.h"
#include "DenseField.h"
#include "SparseField.h"
//----------------------------------------------------------------------------//
#include "ns.h"
FIELD3D_NAMESPACE_OPEN
//----------------------------------------------------------------------------//
// Exceptions
//----------------------------------------------------------------------------//
namespace Exc {
DECLARE_FIELD3D_GENERIC_EXCEPTION(MIPFieldException, Exception)
} // namespace Exc
//----------------------------------------------------------------------------//
// Forward declarations
//----------------------------------------------------------------------------//
template <class T>
class CubicMIPFieldInterp;
//----------------------------------------------------------------------------//
// MIPField
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
template <class Field_T>
class MIPField : public MIPBase<typename Field_T::value_type>
{
public:
// Typedefs ------------------------------------------------------------------
typedef typename Field_T::value_type Data_T;
typedef Field_T NestedType;
typedef boost::intrusive_ptr<MIPField> Ptr;
typedef std::vector<Ptr> Vec;
typedef MIPLinearInterp<MIPField<Field_T> > LinearInterp;
typedef CubicMIPFieldInterp<Data_T> CubicInterp;
typedef Data_T value_type;
typedef EmptyField<Data_T> ProxyField;
typedef typename ProxyField::Ptr ProxyPtr;
typedef std::vector<ProxyPtr> ProxyVec;
typedef typename Field_T::Ptr FieldPtr;
typedef std::vector<FieldPtr> FieldVec;
// Constructors --------------------------------------------------------------
MIPField();
MIPField(const MIPField &other);
const MIPField& operator = (const MIPField &rhs);
// \}
// From FieldRes base class --------------------------------------------------
virtual long long int memSize() const;
virtual void mappingChanged();
// From Field base class -----------------------------------------------------
virtual Data_T value(int i, int j, int k) const;
virtual size_t voxelCount() const;
// RTTI replacement ----------------------------------------------------------
typedef MIPField<Field_T> class_type;
DEFINE_FIELD_RTTI_CONCRETE_CLASS
static const char *staticClassName()
{
return "MIPField";
}
static const char *staticClassType()
{
return MIPField<Field_T>::ms_classType.name();
}
// From MIPField -------------------------------------------------------------
virtual Data_T mipValue(size_t level, int i, int j, int k) const;
virtual V3i mipResolution(size_t level) const;
virtual bool levelLoaded(const size_t level) const;
virtual void getVsMIPCoord(const V3f &vsP, const size_t level,
V3f &outVsP) const;
virtual typename Field<Data_T>::Ptr mipLevel(const size_t level) const;
// Concrete voxel access -----------------------------------------------------
Data_T fastMipValue(size_t level, int i, int j, int k) const;
// From FieldBase ------------------------------------------------------------
FIELD3D_CLASSNAME_CLASSTYPE_IMPLEMENTATION;
virtual FieldBase::Ptr clone() const
{
return Ptr(new MIPField(*this));
}
// Main methods --------------------------------------------------------------
void clear();
void setup(const FieldVec &fields);
void setupLazyLoad(const ProxyVec &proxies,
const typename LazyLoadAction<Field_T>::Vec &actions);
#if 0
FieldPtr mipLevel(const size_t level) const;
#endif
const Field_T* rawMipLevel(const size_t level) const;
typename Field_T::Ptr concreteMipLevel(const size_t level) const;
protected:
// Typedefs ------------------------------------------------------------------
typedef MIPBase<Data_T> base;
// Static data members -------------------------------------------------------
static NestedFieldType<MIPField<Field_T> > ms_classType;
// Preventing instantiation of this helper class -----------------------------
// Data members --------------------------------------------------------------
mutable std::vector<FieldPtr> m_fields;
mutable typename LazyLoadAction<Field_T>::Vec m_loadActions;
mutable std::vector<Field_T*> m_rawFields;
mutable std::vector<V3i> m_mipRes;
mutable std::vector<V3f> m_relativeResolution;
boost::shared_ptr<boost::mutex> m_ioMutex;
// Utility methods -----------------------------------------------------------
const MIPField& init(const MIPField &rhs);
void updateMapping(FieldRes::Ptr field);
void updateAuxMembers() const;
void syncLevelInfo(const size_t level) const;
void loadLevelFromDisk(size_t level) const;
template <typename T>
void sanityChecks(const T &fields);
};
//----------------------------------------------------------------------------//
// Helper classes
//----------------------------------------------------------------------------//
template <typename Data_T>
class MIPSparseField : public MIPField<SparseField<Data_T> >
{
public:
virtual FieldBase::Ptr clone() const
{
return FieldBase::Ptr(new MIPSparseField(*this));
}
};
//----------------------------------------------------------------------------//
template <typename Data_T>
class MIPDenseField : public MIPField<DenseField<Data_T> >
{
public:
virtual FieldBase::Ptr clone() const
{
return FieldBase::Ptr(new MIPDenseField(*this));
}
};
//----------------------------------------------------------------------------//
// MIPField implementations
//----------------------------------------------------------------------------//
template <class Field_T>
MIPField<Field_T>::MIPField()
: base(),
m_ioMutex(new boost::mutex)
{
m_fields.resize(base::m_numLevels);
}
//----------------------------------------------------------------------------//
template <class Field_T>
MIPField<Field_T>::MIPField(const MIPField &other)
: base(other)
{
init(other);
}
//----------------------------------------------------------------------------//
template <class Field_T>
const MIPField<Field_T>&
MIPField<Field_T>::operator = (const MIPField &rhs)
{
base::operator=(rhs);
return init(rhs);
}
//----------------------------------------------------------------------------//
template <class Field_T>
const MIPField<Field_T>&
MIPField<Field_T>::init(const MIPField &rhs)
{
// If any of the fields aren't yet loaded, we can rely on the same load
// actions as the other one
m_loadActions = rhs.m_loadActions;
// Copy all the regular data members
m_mipRes = rhs.m_mipRes;
m_relativeResolution = rhs.m_relativeResolution;
// The contained fields must be individually cloned if they have already
// been loaded
m_fields.resize(rhs.m_fields.size());
m_rawFields.resize(rhs.m_rawFields.size());
for (size_t i = 0, end = m_fields.size(); i < end; ++i) {
// Update the field pointer
if (rhs.m_fields[i]) {
FieldBase::Ptr baseClone = rhs.m_fields[i]->clone();
FieldPtr clone = field_dynamic_cast<Field_T>(baseClone);
if (clone) {
m_fields[i] = clone;
} else {
std::cerr << "MIPField::op=(): Failed to clone." << std::endl;
}
}
// Update the raw pointer
m_rawFields[i] = m_fields[i].get();
}
// New mutex
m_ioMutex.reset(new boost::mutex);
// Done
return *this;
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::clear()
{
m_fields.clear();
m_rawFields.clear();
base::m_numLevels = 0;
base::m_lowestLevel = 0;
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::setup(const FieldVec &fields)
{
// Clear existing data
clear();
// Run sanity checks. This will throw an exception if the fields are invalid.
sanityChecks(fields);
// Update state of object
m_fields = fields;
base::m_numLevels = fields.size();
base::m_lowestLevel = 0;
updateMapping(fields[0]);
updateAuxMembers();
// Resize vectors
m_mipRes.resize(base::m_numLevels);
m_relativeResolution.resize(base::m_numLevels);
// For each MIP level
for (size_t i = 0; i < fields.size(); i++) {
// Update MIP res from real fields
m_mipRes[i] = m_fields[i]->extents().size() + V3i(1);
// Update relative resolutions
m_relativeResolution[i] = V3f(m_mipRes[i]) / m_mipRes[0];
}
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::setupLazyLoad
(const ProxyVec &proxies,
const typename LazyLoadAction<Field_T>::Vec &actions)
{
using namespace Exc;
// Clear existing data
clear();
// Check same number of proxies and actions
if (proxies.size() != actions.size()) {
throw MIPFieldException("Incorrect number of lazy load actions");
}
// Run sanity checks. This will throw an exception if the fields are invalid.
sanityChecks(proxies);
// Store the lazy load actions
m_loadActions = actions;
// Update state of object
base::m_numLevels = proxies.size();
base::m_lowestLevel = 0;
m_fields.resize(base::m_numLevels);
updateMapping(proxies[0]);
updateAuxMembers();
// Resize vectors
m_mipRes.resize(base::m_numLevels);
m_relativeResolution.resize(base::m_numLevels);
for (size_t i = 0; i < proxies.size(); i++) {
// Update mip res from proxy fields
m_mipRes[i] = proxies[i]->extents().size() + V3i(1);
// Update relative resolutions
m_relativeResolution[i] = V3f(m_mipRes[i]) / m_mipRes[0];
}
}
//----------------------------------------------------------------------------//
#if 0
template <class Field_T>
typename MIPField<Field_T>::FieldPtr
MIPField<Field_T>::mipLevel(size_t level) const
{
assert(level < base::m_numLevels);
// Ensure level is loaded.
if (!m_rawFields[level]) {
loadLevelFromDisk(level);
}
return m_fields[level];
}
#endif
//----------------------------------------------------------------------------//
template <class Field_T>
const Field_T*
MIPField<Field_T>::rawMipLevel(size_t level) const
{
assert(level < base::m_numLevels);
// Ensure level is loaded.
if (!m_rawFields[level]) {
loadLevelFromDisk(level);
}
// Return
return m_rawFields[level];
}
//----------------------------------------------------------------------------//
template <class Field_T>
typename Field_T::Ptr
MIPField<Field_T>::concreteMipLevel(size_t level) const
{
assert(level < base::m_numLevels);
// Ensure level is loaded.
if (!m_rawFields[level]) {
loadLevelFromDisk(level);
}
// Return
return m_fields[level];
}
//----------------------------------------------------------------------------//
template <class Field_T>
typename MIPField<Field_T>::Data_T
MIPField<Field_T>::value(int i, int j, int k) const
{
return fastMipValue(0, i, j, k);
}
//----------------------------------------------------------------------------//
template <class Field_T>
size_t
MIPField<Field_T>::voxelCount() const
{
size_t count = 0;
for (size_t i = 0; i < m_fields.size(); i++) {
if (m_fields[i]) {
count += m_fields[i]->voxelCount();
}
}
return count;
}
//----------------------------------------------------------------------------//
template <class Field_T>
long long int MIPField<Field_T>::memSize() const
{
long long int mem = 0;
for (size_t i = 0; i < m_fields.size(); i++) {
if (m_fields[i]) {
mem += m_fields[i]->memSize();
}
}
return mem + sizeof(*this);
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::mappingChanged()
{
// Update MIP offset
const V3i offset =
base::metadata().vecIntMetadata(detail::k_mipOffsetStr, V3i(0));
base::setMIPOffset(offset);
V3i baseRes = base::dataWindow().size() + V3i(1);
if (m_fields[0]) {
m_fields[0]->setMapping(base::mapping());
}
for (size_t i = 1; i < m_fields.size(); i++) {
if (m_fields[i]) {
FieldMapping::Ptr mapping =
detail::adjustedMIPFieldMapping(this, baseRes,
m_fields[i]->extents(), i);
m_fields[i]->setMapping(mapping);
}
}
}
//----------------------------------------------------------------------------//
template <class Field_T>
typename MIPField<Field_T>::Data_T
MIPField<Field_T>::mipValue(size_t level, int i, int j, int k) const
{
return fastMipValue(level, i, j, k);
}
//----------------------------------------------------------------------------//
template <class Field_T>
V3i MIPField<Field_T>::mipResolution(size_t level) const
{
assert(level < base::m_numLevels);
return m_mipRes[level];
}
//----------------------------------------------------------------------------//
template <class Field_T>
bool MIPField<Field_T>::levelLoaded(const size_t level) const
{
assert(level < base::m_numLevels);
return m_rawFields[level] != NULL;
}
//----------------------------------------------------------------------------//
template <typename Field_T>
void MIPField<Field_T>::getVsMIPCoord(const V3f &vsP, const size_t level,
V3f &outVsP) const
{
const V3i &mipOff = base::mipOffset();
// Compute offset of current level
const V3i offset((mipOff.x >> level) << level,
(mipOff.y >> level) << level,
(mipOff.z >> level) << level);
// Difference between current offset and base offset is num voxels
// to offset current level by
const V3f diff = offset - mipOff;
// Incorporate shift due to mip offset
outVsP = (vsP - diff) * pow(2.0, -static_cast<float>(level));
}
//----------------------------------------------------------------------------//
template <typename Field_T>
typename Field<typename MIPField<Field_T>::Data_T>::Ptr
MIPField<Field_T>::mipLevel(const size_t level) const
{
assert(level < base::m_numLevels);
// Ensure level is loaded.
if (!m_rawFields[level]) {
loadLevelFromDisk(level);
}
// Return
return m_fields[level];
}
//----------------------------------------------------------------------------//
template <class Field_T>
typename MIPField<Field_T>::Data_T
MIPField<Field_T>::fastMipValue(size_t level, int i, int j, int k) const
{
assert(level < base::m_numLevels);
// Ensure level is loaded.
if (!m_rawFields[level]) {
loadLevelFromDisk(level);
}
// Read from given level
return m_rawFields[level]->fastValue(i, j, k);
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::updateAuxMembers() const
{
m_rawFields.resize(m_fields.size());
for (size_t i = 0; i < m_fields.size(); i++) {
m_rawFields[i] = m_fields[i].get();
}
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::syncLevelInfo(const size_t level) const
{
// At this point, m_fields[level] is guaranteed in memory
// First sync name, attribute
m_fields[level]->name = base::name;
m_fields[level]->attribute = base::attribute;
// Copy metadata
m_fields[level]->copyMetadata(*this);
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::updateMapping(FieldRes::Ptr field)
{
base::m_extents = field->extents();
base::m_dataWindow = field->dataWindow();
base::setMapping(field->mapping());
}
//----------------------------------------------------------------------------//
template <class Field_T>
void MIPField<Field_T>::loadLevelFromDisk(size_t level) const
{
// Double-check locking
if (!m_rawFields[level]) {
boost::mutex::scoped_lock lock(*m_ioMutex);
if (!m_rawFields[level]) {
// Execute the lazy load action
m_fields[level] = m_loadActions[level]->load();
// Check that field was loaded
if (!m_fields[level]) {
throw Exc::MIPFieldException("Couldn't load MIP level: " +
boost::lexical_cast<std::string>(level));
}
// Remove lazy load action
m_loadActions[level].reset();
// Update aux data
updateAuxMembers();
// Ensure metadata is up to date
syncLevelInfo(level);
// Update the mapping of the loaded field
V3i baseRes = base::dataWindow().size() + V3i(1);
FieldMapping::Ptr mapping =
detail::adjustedMIPFieldMapping(this, baseRes,
m_fields[level]->extents(), level);
m_fields[level]->setMapping(mapping);
}
}
}
//----------------------------------------------------------------------------//
template <class Field_T>
template <class T>
void
MIPField<Field_T>::sanityChecks(const T &fields)
{
using boost::lexical_cast;
using std::string;
using Exc::MIPFieldException;
// Check zero length
if (fields.size() == 0) {
throw MIPFieldException("Zero fields in input");
}
// Check all non-null
for (size_t i = 0; i < fields.size(); i++) {
if (!fields[i]) {
throw MIPFieldException("Found null pointer in input");
}
}
// Check decreasing resolution at higher levels
V3i prevSize = fields[0]->extents().size();
for (size_t i = 1; i < fields.size(); i++) {
V3i size = fields[i]->extents().size();
if (size.x > prevSize.x ||
size.y > prevSize.y ||
size.z > prevSize.z) {
throw MIPFieldException("Field " + lexical_cast<string>(i) +
" had greater resolution than previous"
" level");
}
if (size.x >= prevSize.x &&
size.y >= prevSize.y &&
size.z >= prevSize.z) {
throw MIPFieldException("Field " + lexical_cast<string>(i) +
" did not decrease in resolution from "
" previous level: " +
lexical_cast<string>(size) + " > " +
lexical_cast<string>(prevSize));
}
prevSize = size;
}
// All good.
}
//----------------------------------------------------------------------------//
// Static data member instantiation
//----------------------------------------------------------------------------//
template <typename Field_T>
NestedFieldType<MIPField<Field_T> > MIPField<Field_T>::ms_classType =
NestedFieldType<MIPField<Field_T> >();
//----------------------------------------------------------------------------//
FIELD3D_NAMESPACE_HEADER_CLOSE
//----------------------------------------------------------------------------//
#endif // Include guard
DenseField.h
Contains the DenseField class.
EmptyField.h
Contains the EmptyField class.
DECLARE_FIELD3D_GENERIC_EXCEPTION
#define DECLARE_FIELD3D_GENERIC_EXCEPTION(name, base_class)
Used to declare a generic but named exception.
Definition Exception.h:107
MIPBase.h
Contains MIPBase class.
MIPInterp.h
Contains MIPInterp class.
MIPUtil.h
Contains MIP-related utility functions.
DEFINE_FIELD_RTTI_CONCRETE_CLASS
#define DEFINE_FIELD_RTTI_CONCRETE_CLASS
Definition RefCount.h:84
SparseField.h
Contains the SparseField class.
V3i
Imath::V3i V3i
Definition SpiMathLib.h:71
V3f
Imath::V3f V3f
Definition SpiMathLib.h:73
CubicMIPFieldInterp
Definition MIPField.h:80
EmptyField
This subclass of Field does not store any data.
Definition EmptyField.h:88
EmptyField::Ptr
boost::intrusive_ptr< EmptyField > Ptr
Definition EmptyField.h:93
Exc::Exception
Definition Exception.h:74
FieldBase::Ptr
boost::intrusive_ptr< FieldBase > Ptr
Definition Field.h:97
FieldBase::metadata
FieldMetadata & metadata()
accessor to the m_metadata class
Definition Field.h:155
FieldBase::attribute
std::string attribute
Optional name of the attribute the field represents.
Definition Field.h:173
FieldBase::name
std::string name
Optional name of the field.
Definition Field.h:171
FieldMapping::Ptr
boost::intrusive_ptr< FieldMapping > Ptr
Definition FieldMapping.h:92
FieldRes::m_extents
Box3i m_extents
Defines the extents of the the storage. This may be larger or smaller than the data window,...
Definition Field.h:307
FieldRes::setMapping
void setMapping(FieldMapping::Ptr mapping)
Sets the field's mapping.
Definition Field.h:347
FieldRes::Ptr
boost::intrusive_ptr< FieldRes > Ptr
Definition Field.h:213
FieldRes::mapping
FieldMapping::Ptr mapping()
Returns a pointer to the mapping.
Definition Field.h:263
FieldRes::m_dataWindow
Box3i m_dataWindow
Defines the area where data is allocated. This should be treated as a closed (i.e....
Definition Field.h:310
FieldRes::extents
const Box3i & extents() const
Returns the extents of the data. This signifies the relevant area that the data exists over....
Definition Field.h:249
FieldRes::dataWindow
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
Field
Definition Field.h:390
Field::Ptr
boost::intrusive_ptr< Field > Ptr
Definition Field.h:395
LazyLoadAction::Vec
std::vector< Ptr > Vec
Definition MIPBase.h:78
MIPBase::mipOffset
const V3i & mipOffset() const
Returns the base MIP offset.
Definition MIPBase.h:180
MIPBase::m_lowestLevel
size_t m_lowestLevel
The lowest MIP level to use. Defaults to 0, but can be set higher to prevent high resolution levels f...
Definition MIPBase.h:199
MIPBase::m_numLevels
size_t m_numLevels
Number of MIP levels. The default is 1.
Definition MIPBase.h:196
MIPBase::setMIPOffset
void setMIPOffset(const V3i &offset)
Sets the base MIP offset. This is used to indicate where voxel space coordinate (0,...
Definition MIPBase.h:230
MIPBase< Field_T::value_type >::MIPBase
MIPBase()
Definition MIPBase.h:213
MIPDenseField
Definition MIPField.h:311
MIPDenseField::clone
virtual FieldBase::Ptr clone() const
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement i...
Definition MIPField.h:313
MIPField
This subclass stores a MIP representation of a Field_T field.
Definition MIPField.h:110
MIPField::rawMipLevel
const Field_T * rawMipLevel(const size_t level) const
Returns a raw pointer to a MIP level.
Definition MIPField.h:481
MIPField::m_ioMutex
boost::shared_ptr< boost::mutex > m_ioMutex
Mutex lock around IO. Used to make sure only one thread reads MIP level data at a time....
Definition MIPField.h:271
MIPField::ProxyField
EmptyField< Data_T > ProxyField
Definition MIPField.h:126
MIPField::mipValue
virtual Data_T mipValue(size_t level, int i, int j, int k) const
Read access to a voxel in a given MIP level.
Definition MIPField.h:573
MIPField::Ptr
boost::intrusive_ptr< MIPField > Ptr
Definition MIPField.h:118
MIPField::syncLevelInfo
void syncLevelInfo(const size_t level) const
Updates the name, attribute and metadata for a given level.
Definition MIPField.h:661
MIPField::getVsMIPCoord
virtual void getVsMIPCoord(const V3f &vsP, const size_t level, V3f &outVsP) const
Given a voxel space coordinate in the 0-level field, computes the coordinate in another level.
Definition MIPField.h:599
MIPField::NestedType
Field_T NestedType
Definition MIPField.h:116
MIPField::levelLoaded
virtual bool levelLoaded(const size_t level) const
Whether a given MIP level is loaded.
Definition MIPField.h:590
MIPField::MIPField
MIPField()
Constructs an empty MIP field.
Definition MIPField.h:324
MIPField::FieldVec
std::vector< FieldPtr > FieldVec
Definition MIPField.h:131
MIPField::Vec
std::vector< Ptr > Vec
Definition MIPField.h:119
MIPField::updateMapping
void updateMapping(FieldRes::Ptr field)
Updates the mapping, extents and data window to match the given field. Used so that the MIPField will...
Definition MIPField.h:675
MIPField::class_type
MIPField< Field_T > class_type
Definition MIPField.h:173
MIPField::memSize
virtual long long int memSize() const
Returns the memory usage (in bytes).
Definition MIPField.h:534
MIPField::staticClassName
static DEFINE_FIELD_RTTI_CONCRETE_CLASS const char * staticClassName()
Definition MIPField.h:176
MIPField::setup
void setup(const FieldVec &fields)
Sets up the MIP field given a set of non-MIP fields This call performs sanity checking to ensure that...
Definition MIPField.h:400
MIPField::CubicInterp
CubicMIPFieldInterp< Data_T > CubicInterp
Definition MIPField.h:122
MIPField::mipLevel
virtual Field< Data_T >::Ptr mipLevel(const size_t level) const
Returns a MIP level field.
Definition MIPField.h:621
MIPField::Data_T
Field_T::value_type Data_T
Definition MIPField.h:115
MIPField::ms_classType
static NestedFieldType< MIPField< Field_T > > ms_classType
Definition MIPField.h:246
MIPField::loadLevelFromDisk
void loadLevelFromDisk(size_t level) const
Loads the given level from disk.
Definition MIPField.h:685
MIPField::ProxyPtr
ProxyField::Ptr ProxyPtr
Definition MIPField.h:127
MIPField::mappingChanged
virtual void mappingChanged()
We need to know if the mapping changed so that we may update the MIP levels' mappings.
Definition MIPField.h:548
MIPField::LinearInterp
MIPLinearInterp< MIPField< Field_T > > LinearInterp
Definition MIPField.h:121
MIPField::base
MIPBase< Data_T > base
Definition MIPField.h:242
MIPField::concreteMipLevel
Field_T::Ptr concreteMipLevel(const size_t level) const
Returns a concretely typed pointer to a MIP level.
Definition MIPField.h:496
MIPField::fastMipValue
Data_T fastMipValue(size_t level, int i, int j, int k) const
Read access to voxel at a given MIP level.
Definition MIPField.h:636
MIPField::clone
virtual FieldBase::Ptr clone() const
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement i...
Definition MIPField.h:207
MIPField::voxelCount
virtual size_t voxelCount() const
Counts the number of voxels. For most fields, this is just the volume of the data window,...
Definition MIPField.h:520
MIPField::clear
void clear()
Clears all the levels of the MIP field.
Definition MIPField.h:389
MIPField::FIELD3D_CLASSNAME_CLASSTYPE_IMPLEMENTATION
FIELD3D_CLASSNAME_CLASSTYPE_IMPLEMENTATION
Definition MIPField.h:205
MIPField::mipResolution
virtual V3i mipResolution(size_t level) const
Returns the resolution of a given MIP level.
Definition MIPField.h:581
MIPField::setupLazyLoad
void setupLazyLoad(const ProxyVec &proxies, const typename LazyLoadAction< Field_T >::Vec &actions)
Sets up the MIP field in lazy-load mode.
Definition MIPField.h:428
MIPField::updateAuxMembers
void updateAuxMembers() const
Updates the dependent data members based on m_field.
Definition MIPField.h:650
MIPField::m_mipRes
std::vector< V3i > m_mipRes
Resolution of each MIP level.
Definition MIPField.h:264
MIPField::FieldPtr
Field_T::Ptr FieldPtr
Definition MIPField.h:130
MIPField::value
virtual Data_T value(int i, int j, int k) const
Read access to a voxel. The coordinates are in integer voxel space .
Definition MIPField.h:511
MIPField::ProxyVec
std::vector< ProxyPtr > ProxyVec
Definition MIPField.h:128
MIPField::sanityChecks
void sanityChecks(const T &fields)
Sanity checks to ensure that the provided Fields are a MIP representation.
Definition MIPField.h:719
MIPField::m_fields
std::vector< FieldPtr > m_fields
Storage of all MIP levels. Some or all of the pointers may be NULL. This is mutable because it needs ...
Definition MIPField.h:256
MIPField::init
const MIPField & init(const MIPField &rhs)
Copies from a second MIPField.
Definition MIPField.h:354
MIPField::staticClassType
static const char * staticClassType()
Definition MIPField.h:181
MIPField::value_type
Data_T value_type
Definition MIPField.h:124
MIPField::m_loadActions
LazyLoadAction< Field_T >::Vec m_loadActions
Lazy load actions. Only used if setupLazyLoad() has been called.
Definition MIPField.h:258
MIPField::m_rawFields
std::vector< Field_T * > m_rawFields
Raw pointers to MIP levels.
Definition MIPField.h:262
MIPField::operator=
const MIPField & operator=(const MIPField &rhs)
Assignment operator.
Definition MIPField.h:344
MIPField::m_relativeResolution
std::vector< V3f > m_relativeResolution
Relative resolution of each MIP level. Pre-computed to avoid int-to-float conversions.
Definition MIPField.h:267
MIPLinearInterp
Definition MIPInterp.h:62
MIPSparseField
Definition MIPField.h:299
MIPSparseField::clone
virtual FieldBase::Ptr clone() const
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement i...
Definition MIPField.h:301
RefBase::operator=
RefBase & operator=(const RefBase &)
Assignment operator.
Definition RefCount.h:134
field_dynamic_cast
Field_T::Ptr field_dynamic_cast(RefBase::Ptr field)
Dynamic cast that uses string-comparison in order to be safe even after an object crosses a shared li...
Definition RefCount.h:256
Exc
Namespace for Exception objects.
Definition Exception.h:57
FIELD3D_NAMESPACE_OPEN
Definition FieldMapping.cpp:74
detail::k_mipOffsetStr
const std::string k_mipOffsetStr
Definition MIPUtil.cpp:66
detail::adjustedMIPFieldMapping
FIELD3D_API FieldMapping::Ptr adjustedMIPFieldMapping(const FieldRes *base, const V3i &baseRes, const Box3i &extents, const size_t level)
Definition MIPUtil.cpp:82
ns.h
FIELD3D_NAMESPACE_HEADER_CLOSE
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition ns.h:58
NestedFieldType
Used to return a string for the name of a nested templated field.
Definition Traits.h:307