Field3D
MIPField.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------//
2
3/*
4 * Copyright (c) 2009 Sony Pictures Imageworks Inc
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the
17 * distribution. Neither the name of Sony Pictures Imageworks nor the
18 * names of its contributors may be used to endorse or promote
19 * products derived from this software without specific prior written
20 * permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33 * OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36//----------------------------------------------------------------------------//
37
42//----------------------------------------------------------------------------//
43
44#ifndef _INCLUDED_MIPField_H_
45#define _INCLUDED_MIPField_H_
46
47#include <vector>
48
49#include <boost/lexical_cast.hpp>
50#include <boost/thread/mutex.hpp>
51
52#include "EmptyField.h"
53#include "MIPBase.h"
54#include "MIPInterp.h"
55#include "MIPUtil.h"
56#include "DenseField.h"
57#include "SparseField.h"
58
59//----------------------------------------------------------------------------//
60
61#include "ns.h"
62
64
65//----------------------------------------------------------------------------//
66// Exceptions
67//----------------------------------------------------------------------------//
68
69namespace Exc {
70
72
73} // namespace Exc
74
75//----------------------------------------------------------------------------//
76// Forward declarations
77//----------------------------------------------------------------------------//
78
79template <class T>
81
82//----------------------------------------------------------------------------//
83// MIPField
84//----------------------------------------------------------------------------//
85
106//----------------------------------------------------------------------------//
107
108template <class Field_T>
109class MIPField : public MIPBase<typename Field_T::value_type>
110{
111public:
112
113 // Typedefs ------------------------------------------------------------------
114
115 typedef typename Field_T::value_type Data_T;
116 typedef Field_T NestedType;
117
118 typedef boost::intrusive_ptr<MIPField> Ptr;
119 typedef std::vector<Ptr> Vec;
120
123
125
127 typedef typename ProxyField::Ptr ProxyPtr;
128 typedef std::vector<ProxyPtr> ProxyVec;
129
130 typedef typename Field_T::Ptr FieldPtr;
131 typedef std::vector<FieldPtr> FieldVec;
132
133 // Constructors --------------------------------------------------------------
134
137
140
144
147
148 // \}
149
150 // From FieldRes base class --------------------------------------------------
151
156 virtual long long int memSize() const;
159 virtual void mappingChanged();
161
162 // From Field base class -----------------------------------------------------
163
167 virtual Data_T value(int i, int j, int k) const;
168 virtual size_t voxelCount() const;
170
171 // RTTI replacement ----------------------------------------------------------
172
175
176 static const char *staticClassName()
177 {
178 return "MIPField";
179 }
180
181 static const char *staticClassType()
182 {
184 }
185
186 // From MIPField -------------------------------------------------------------
187
188 virtual Data_T mipValue(size_t level, int i, int j, int k) const;
189 virtual V3i mipResolution(size_t level) const;
190 virtual bool levelLoaded(const size_t level) const;
191 virtual void getVsMIPCoord(const V3f &vsP, const size_t level,
192 V3f &outVsP) const;
193 virtual typename Field<Data_T>::Ptr mipLevel(const size_t level) const;
194
195 // Concrete voxel access -----------------------------------------------------
196
198 Data_T fastMipValue(size_t level, int i, int j, int k) const;
199
200 // From FieldBase ------------------------------------------------------------
201
204
206
207 virtual FieldBase::Ptr clone() const
208 {
209 return Ptr(new MIPField(*this));
210 }
211
213
214 // Main methods --------------------------------------------------------------
215
217 void clear();
223 void setup(const FieldVec &fields);
227 const typename LazyLoadAction<Field_T>::Vec &actions);
228
229#if 0
231 FieldPtr mipLevel(const size_t level) const;
232#endif
234 const Field_T* rawMipLevel(const size_t level) const;
236 typename Field_T::Ptr concreteMipLevel(const size_t level) const;
237
238protected:
239
240 // Typedefs ------------------------------------------------------------------
241
243
244 // Static data members -------------------------------------------------------
245
247
248 // Preventing instantiation of this helper class -----------------------------
249
250
251
252 // Data members --------------------------------------------------------------
253
256 mutable std::vector<FieldPtr> m_fields;
262 mutable std::vector<Field_T*> m_rawFields;
264 mutable std::vector<V3i> m_mipRes;
267 mutable std::vector<V3f> m_relativeResolution;
271 boost::shared_ptr<boost::mutex> m_ioMutex;
272
273 // Utility methods -----------------------------------------------------------
274
276 const MIPField& init(const MIPField &rhs);
282 void updateAuxMembers() const;
284 void syncLevelInfo(const size_t level) const;
286 void loadLevelFromDisk(size_t level) const;
288 template <typename T>
289 void sanityChecks(const T &fields);
290
291};
292
293//----------------------------------------------------------------------------//
294// Helper classes
295//----------------------------------------------------------------------------//
296
297template <typename Data_T>
298class MIPSparseField : public MIPField<SparseField<Data_T> >
299{
300public:
301 virtual FieldBase::Ptr clone() const
302 {
303 return FieldBase::Ptr(new MIPSparseField(*this));
304 }
305};
306
307//----------------------------------------------------------------------------//
308
309template <typename Data_T>
310class MIPDenseField : public MIPField<DenseField<Data_T> >
311{
312 public:
313 virtual FieldBase::Ptr clone() const
314 {
315 return FieldBase::Ptr(new MIPDenseField(*this));
316 }
317};
318
319//----------------------------------------------------------------------------//
320// MIPField implementations
321//----------------------------------------------------------------------------//
322
323template <class Field_T>
325 : base(),
326 m_ioMutex(new boost::mutex)
327{
329}
330
331//----------------------------------------------------------------------------//
332
333template <class Field_T>
339
340//----------------------------------------------------------------------------//
341
342template <class Field_T>
343const MIPField<Field_T>&
345{
346 base::operator=(rhs);
347 return init(rhs);
348}
349
350//----------------------------------------------------------------------------//
351
352template <class Field_T>
353const MIPField<Field_T>&
355{
356 // If any of the fields aren't yet loaded, we can rely on the same load
357 // actions as the other one
358 m_loadActions = rhs.m_loadActions;
359 // Copy all the regular data members
360 m_mipRes = rhs.m_mipRes;
361 m_relativeResolution = rhs.m_relativeResolution;
362 // The contained fields must be individually cloned if they have already
363 // been loaded
364 m_fields.resize(rhs.m_fields.size());
365 m_rawFields.resize(rhs.m_rawFields.size());
366 for (size_t i = 0, end = m_fields.size(); i < end; ++i) {
367 // Update the field pointer
368 if (rhs.m_fields[i]) {
369 FieldBase::Ptr baseClone = rhs.m_fields[i]->clone();
371 if (clone) {
372 m_fields[i] = clone;
373 } else {
374 std::cerr << "MIPField::op=(): Failed to clone." << std::endl;
375 }
376 }
377 // Update the raw pointer
378 m_rawFields[i] = m_fields[i].get();
379 }
380 // New mutex
381 m_ioMutex.reset(new boost::mutex);
382 // Done
383 return *this;
384}
385
386//----------------------------------------------------------------------------//
387
388template <class Field_T>
390{
391 m_fields.clear();
392 m_rawFields.clear();
393 base::m_numLevels = 0;
394 base::m_lowestLevel = 0;
395}
396
397//----------------------------------------------------------------------------//
398
399template <class Field_T>
401{
402 // Clear existing data
403 clear();
404 // Run sanity checks. This will throw an exception if the fields are invalid.
405 sanityChecks(fields);
406 // Update state of object
407 m_fields = fields;
408 base::m_numLevels = fields.size();
409 base::m_lowestLevel = 0;
410 updateMapping(fields[0]);
411 updateAuxMembers();
412 // Resize vectors
413 m_mipRes.resize(base::m_numLevels);
414 m_relativeResolution.resize(base::m_numLevels);
415 // For each MIP level
416 for (size_t i = 0; i < fields.size(); i++) {
417 // Update MIP res from real fields
418 m_mipRes[i] = m_fields[i]->extents().size() + V3i(1);
419 // Update relative resolutions
420 m_relativeResolution[i] = V3f(m_mipRes[i]) / m_mipRes[0];
421 }
422}
423
424//----------------------------------------------------------------------------//
425
426template <class Field_T>
428(const ProxyVec &proxies,
430{
431 using namespace Exc;
432
433 // Clear existing data
434 clear();
435 // Check same number of proxies and actions
436 if (proxies.size() != actions.size()) {
437 throw MIPFieldException("Incorrect number of lazy load actions");
438 }
439 // Run sanity checks. This will throw an exception if the fields are invalid.
440 sanityChecks(proxies);
441 // Store the lazy load actions
442 m_loadActions = actions;
443 // Update state of object
444 base::m_numLevels = proxies.size();
445 base::m_lowestLevel = 0;
446 m_fields.resize(base::m_numLevels);
447 updateMapping(proxies[0]);
448 updateAuxMembers();
449 // Resize vectors
450 m_mipRes.resize(base::m_numLevels);
451 m_relativeResolution.resize(base::m_numLevels);
452 for (size_t i = 0; i < proxies.size(); i++) {
453 // Update mip res from proxy fields
454 m_mipRes[i] = proxies[i]->extents().size() + V3i(1);
455 // Update relative resolutions
456 m_relativeResolution[i] = V3f(m_mipRes[i]) / m_mipRes[0];
457 }
458}
459
460//----------------------------------------------------------------------------//
461
462#if 0
463
464template <class Field_T>
467{
468 assert(level < base::m_numLevels);
469 // Ensure level is loaded.
470 if (!m_rawFields[level]) {
471 loadLevelFromDisk(level);
472 }
473 return m_fields[level];
474}
475#endif
476
477//----------------------------------------------------------------------------//
478
479template <class Field_T>
480const Field_T*
482{
483 assert(level < base::m_numLevels);
484 // Ensure level is loaded.
485 if (!m_rawFields[level]) {
486 loadLevelFromDisk(level);
487 }
488 // Return
489 return m_rawFields[level];
490}
491
492//----------------------------------------------------------------------------//
493
494template <class Field_T>
495typename Field_T::Ptr
497{
498 assert(level < base::m_numLevels);
499 // Ensure level is loaded.
500 if (!m_rawFields[level]) {
501 loadLevelFromDisk(level);
502 }
503 // Return
504 return m_fields[level];
505}
506
507//----------------------------------------------------------------------------//
508
509template <class Field_T>
511MIPField<Field_T>::value(int i, int j, int k) const
512{
513 return fastMipValue(0, i, j, k);
514}
515
516//----------------------------------------------------------------------------//
517
518template <class Field_T>
519size_t
521{
522 size_t count = 0;
523 for (size_t i = 0; i < m_fields.size(); i++) {
524 if (m_fields[i]) {
525 count += m_fields[i]->voxelCount();
526 }
527 }
528 return count;
529}
530
531//----------------------------------------------------------------------------//
532
533template <class Field_T>
534long long int MIPField<Field_T>::memSize() const
535{
536 long long int mem = 0;
537 for (size_t i = 0; i < m_fields.size(); i++) {
538 if (m_fields[i]) {
539 mem += m_fields[i]->memSize();
540 }
541 }
542 return mem + sizeof(*this);
543}
544
545//----------------------------------------------------------------------------//
546
547template <class Field_T>
549{
550 // Update MIP offset
551 const V3i offset =
552 base::metadata().vecIntMetadata(detail::k_mipOffsetStr, V3i(0));
553 base::setMIPOffset(offset);
554
555 V3i baseRes = base::dataWindow().size() + V3i(1);
556 if (m_fields[0]) {
557 m_fields[0]->setMapping(base::mapping());
558 }
559 for (size_t i = 1; i < m_fields.size(); i++) {
560 if (m_fields[i]) {
561 FieldMapping::Ptr mapping =
563 m_fields[i]->extents(), i);
564 m_fields[i]->setMapping(mapping);
565 }
566 }
567}
568
569//----------------------------------------------------------------------------//
570
571template <class Field_T>
573MIPField<Field_T>::mipValue(size_t level, int i, int j, int k) const
574{
575 return fastMipValue(level, i, j, k);
576}
577
578//----------------------------------------------------------------------------//
579
580template <class Field_T>
582{
583 assert(level < base::m_numLevels);
584 return m_mipRes[level];
585}
586
587//----------------------------------------------------------------------------//
588
589template <class Field_T>
590bool MIPField<Field_T>::levelLoaded(const size_t level) const
591{
592 assert(level < base::m_numLevels);
593 return m_rawFields[level] != NULL;
594}
595
596//----------------------------------------------------------------------------//
597
598template <typename Field_T>
600 V3f &outVsP) const
601{
602 const V3i &mipOff = base::mipOffset();
603
604 // Compute offset of current level
605 const V3i offset((mipOff.x >> level) << level,
606 (mipOff.y >> level) << level,
607 (mipOff.z >> level) << level);
608
609 // Difference between current offset and base offset is num voxels
610 // to offset current level by
611 const V3f diff = offset - mipOff;
612
613 // Incorporate shift due to mip offset
614 outVsP = (vsP - diff) * pow(2.0, -static_cast<float>(level));
615}
616
617//----------------------------------------------------------------------------//
618
619template <typename Field_T>
622{
623 assert(level < base::m_numLevels);
624 // Ensure level is loaded.
625 if (!m_rawFields[level]) {
626 loadLevelFromDisk(level);
627 }
628 // Return
629 return m_fields[level];
630}
631
632//----------------------------------------------------------------------------//
633
634template <class Field_T>
636MIPField<Field_T>::fastMipValue(size_t level, int i, int j, int k) const
637{
638 assert(level < base::m_numLevels);
639 // Ensure level is loaded.
640 if (!m_rawFields[level]) {
641 loadLevelFromDisk(level);
642 }
643 // Read from given level
644 return m_rawFields[level]->fastValue(i, j, k);
645}
646
647//----------------------------------------------------------------------------//
648
649template <class Field_T>
651{
652 m_rawFields.resize(m_fields.size());
653 for (size_t i = 0; i < m_fields.size(); i++) {
654 m_rawFields[i] = m_fields[i].get();
655 }
656}
657
658//----------------------------------------------------------------------------//
659
660template <class Field_T>
662{
663 // At this point, m_fields[level] is guaranteed in memory
664
665 // First sync name, attribute
666 m_fields[level]->name = base::name;
667 m_fields[level]->attribute = base::attribute;
668 // Copy metadata
669 m_fields[level]->copyMetadata(*this);
670}
671
672//----------------------------------------------------------------------------//
673
674template <class Field_T>
676{
677 base::m_extents = field->extents();
678 base::m_dataWindow = field->dataWindow();
679 base::setMapping(field->mapping());
680}
681
682//----------------------------------------------------------------------------//
683
684template <class Field_T>
686{
687 // Double-check locking
688 if (!m_rawFields[level]) {
689 boost::mutex::scoped_lock lock(*m_ioMutex);
690 if (!m_rawFields[level]) {
691 // Execute the lazy load action
692 m_fields[level] = m_loadActions[level]->load();
693 // Check that field was loaded
694 if (!m_fields[level]) {
695 throw Exc::MIPFieldException("Couldn't load MIP level: " +
696 boost::lexical_cast<std::string>(level));
697 }
698 // Remove lazy load action
699 m_loadActions[level].reset();
700 // Update aux data
701 updateAuxMembers();
702 // Ensure metadata is up to date
703 syncLevelInfo(level);
704 // Update the mapping of the loaded field
705 V3i baseRes = base::dataWindow().size() + V3i(1);
706 FieldMapping::Ptr mapping =
708 m_fields[level]->extents(), level);
709 m_fields[level]->setMapping(mapping);
710 }
711 }
712}
713
714//----------------------------------------------------------------------------//
715
716template <class Field_T>
717template <class T>
718void
720{
721 using boost::lexical_cast;
722 using std::string;
723 using Exc::MIPFieldException;
724
725 // Check zero length
726 if (fields.size() == 0) {
727 throw MIPFieldException("Zero fields in input");
728 }
729 // Check all non-null
730 for (size_t i = 0; i < fields.size(); i++) {
731 if (!fields[i]) {
732 throw MIPFieldException("Found null pointer in input");
733 }
734 }
735 // Check decreasing resolution at higher levels
736 V3i prevSize = fields[0]->extents().size();
737 for (size_t i = 1; i < fields.size(); i++) {
738 V3i size = fields[i]->extents().size();
739 if (size.x > prevSize.x ||
740 size.y > prevSize.y ||
741 size.z > prevSize.z) {
742 throw MIPFieldException("Field " + lexical_cast<string>(i) +
743 " had greater resolution than previous"
744 " level");
745 }
746 if (size.x >= prevSize.x &&
747 size.y >= prevSize.y &&
748 size.z >= prevSize.z) {
749 throw MIPFieldException("Field " + lexical_cast<string>(i) +
750 " did not decrease in resolution from "
751 " previous level: " +
752 lexical_cast<string>(size) + " > " +
754 }
755 prevSize = size;
756 }
757 // All good.
758}
759
760//----------------------------------------------------------------------------//
761// Static data member instantiation
762//----------------------------------------------------------------------------//
763
764template <typename Field_T>
767
768//----------------------------------------------------------------------------//
769
771
772//----------------------------------------------------------------------------//
773
774#endif // Include guard
Contains the DenseField class.
Contains the EmptyField class.
#define DECLARE_FIELD3D_GENERIC_EXCEPTION(name, base_class)
Used to declare a generic but named exception.
Definition Exception.h:107
Contains MIPBase class.
Contains MIPInterp class.
Contains MIP-related utility functions.
#define DEFINE_FIELD_RTTI_CONCRETE_CLASS
Definition RefCount.h:84
Contains the SparseField class.
Imath::V3i V3i
Definition SpiMathLib.h:71
Imath::V3f V3f
Definition SpiMathLib.h:73
#define FIELD3D_MTX_T
Definition StdMathLib.h:99
This subclass of Field does not store any data.
Definition EmptyField.h:88
boost::intrusive_ptr< EmptyField > Ptr
Definition EmptyField.h:93
boost::intrusive_ptr< FieldBase > Ptr
Definition Field.h:97
std::string name
Optional name of the field.
Definition Field.h:171
boost::intrusive_ptr< FieldMapping > Ptr
boost::intrusive_ptr< FieldRes > Ptr
Definition Field.h:213
Definition Field.h:390
boost::intrusive_ptr< Field > Ptr
Definition Field.h:395
std::vector< Ptr > Vec
Definition MIPBase.h:78
size_t m_numLevels
Number of MIP levels. The default is 1.
Definition MIPBase.h:196
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
This subclass stores a MIP representation of a Field_T field.
Definition MIPField.h:110
const Field_T * rawMipLevel(const size_t level) const
Returns a raw pointer to a MIP level.
Definition MIPField.h:481
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
EmptyField< Data_T > ProxyField
Definition MIPField.h:126
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
boost::intrusive_ptr< MIPField > Ptr
Definition MIPField.h:118
void syncLevelInfo(const size_t level) const
Updates the name, attribute and metadata for a given level.
Definition MIPField.h:661
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
static NestedFieldType< MIPField< Field_T > > ms_classType
Definition MIPField.h:246
Field_T NestedType
Definition MIPField.h:116
virtual bool levelLoaded(const size_t level) const
Whether a given MIP level is loaded.
Definition MIPField.h:590
MIPField()
Constructs an empty MIP field.
Definition MIPField.h:324
std::vector< FieldPtr > FieldVec
Definition MIPField.h:131
std::vector< Ptr > Vec
Definition MIPField.h:119
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< Field_T > class_type
Definition MIPField.h:173
virtual long long int memSize() const
Returns the memory usage (in bytes)
Definition MIPField.h:534
static DEFINE_FIELD_RTTI_CONCRETE_CLASS const char * staticClassName()
Definition MIPField.h:176
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
CubicMIPFieldInterp< Data_T > CubicInterp
Definition MIPField.h:122
virtual Field< Data_T >::Ptr mipLevel(const size_t level) const
Returns a MIP level field.
Definition MIPField.h:621
Field_T::value_type Data_T
Definition MIPField.h:115
void loadLevelFromDisk(size_t level) const
Loads the given level from disk.
Definition MIPField.h:685
ProxyField::Ptr ProxyPtr
Definition MIPField.h:127
virtual void mappingChanged()
We need to know if the mapping changed so that we may update the MIP levels' mappings.
Definition MIPField.h:548
MIPLinearInterp< MIPField< Field_T > > LinearInterp
Definition MIPField.h:121
MIPBase< Data_T > base
Definition MIPField.h:242
Field_T::Ptr concreteMipLevel(const size_t level) const
Returns a concretely typed pointer to a MIP level.
Definition MIPField.h:496
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
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
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
void clear()
Clears all the levels of the MIP field.
Definition MIPField.h:389
FIELD3D_CLASSNAME_CLASSTYPE_IMPLEMENTATION
Definition MIPField.h:205
virtual V3i mipResolution(size_t level) const
Returns the resolution of a given MIP level.
Definition MIPField.h:581
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
void updateAuxMembers() const
Updates the dependent data members based on m_field.
Definition MIPField.h:650
std::vector< V3i > m_mipRes
Resolution of each MIP level.
Definition MIPField.h:264
Field_T::Ptr FieldPtr
Definition MIPField.h:130
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
std::vector< ProxyPtr > ProxyVec
Definition MIPField.h:128
void sanityChecks(const T &fields)
Sanity checks to ensure that the provided Fields are a MIP representation.
Definition MIPField.h:719
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
const MIPField & init(const MIPField &rhs)
Copies from a second MIPField.
Definition MIPField.h:354
static const char * staticClassType()
Definition MIPField.h:181
MIPField(const MIPField &other)
Copy constructor. We need this because a) we own a mutex and b) we own shared pointers and shallow co...
Definition MIPField.h:334
Data_T value_type
Definition MIPField.h:124
LazyLoadAction< Field_T >::Vec m_loadActions
Lazy load actions. Only used if setupLazyLoad() has been called.
Definition MIPField.h:258
std::vector< Field_T * > m_rawFields
Raw pointers to MIP levels.
Definition MIPField.h:262
const MIPField & operator=(const MIPField &rhs)
Assignment operator.
Definition MIPField.h:344
std::vector< V3f > m_relativeResolution
Relative resolution of each MIP level. Pre-computed to avoid int-to-float conversions.
Definition MIPField.h:267
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
Namespace for Exception objects.
Definition Exception.h:57
const std::string k_mipOffsetStr
Definition MIPUtil.cpp:66
FIELD3D_API FieldMapping::Ptr adjustedMIPFieldMapping(const FieldRes *base, const V3i &baseRes, const Box3i &extents, const size_t level)
Definition MIPUtil.cpp:82
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition ns.h:58
Used to return a string for the name of a nested templated field.
Definition Traits.h:307