Commit 9582dcbc authored by schultezub's avatar schultezub
Browse files

=== major refactoring FINISHED: CAMPVis is working again as intended ===

Revising ImageData concept step 3:
 * Removed ImageRepresentationConverter class
 * Introduced ImageRepresentationXYZ::tryConvertFrom() for conversion


git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@402 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent caa7620d
......@@ -46,10 +46,10 @@ using namespace campvis;
int main(int argc, char** argv) {
CampVisApplication app(argc, argv);
app.addVisualizationPipeline("Advanced Ultrasound Visualization", new AdvancedUsVis());
//app.addVisualizationPipeline("IXPV", new IxpvDemo());
//app.addVisualizationPipeline("SliceVis", new SliceVis());
//app.addVisualizationPipeline("DVRVis", new DVRVis());
//app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
// app.addVisualizationPipeline("IXPV", new IxpvDemo());
// app.addVisualizationPipeline("SliceVis", new SliceVis());
// app.addVisualizationPipeline("DVRVis", new DVRVis());
// app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
app.init();
int toReturn = app.run();
......
......@@ -140,15 +140,15 @@ namespace campvis {
std::vector<const tgt::Texture*> textures;
for (std::map<std::string, DataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
if (const ImageRepresentationGL* imgGL = dynamic_cast<const ImageRepresentationGL*>(it->second.getData())) {
textures.push_back(imgGL->getTexture());
}
else if (const ImageRepresentationRenderTarget* imgRT = dynamic_cast<const ImageRepresentationRenderTarget*>(it->second.getData())) {
if (imgRT->getDimensionality() == 2) {
if (const ImageData* img = dynamic_cast<const ImageData*>(it->second.getData())) {
if (const ImageRepresentationRenderTarget* imgRT = img->getRepresentation<ImageRepresentationRenderTarget>(false)) {
for (size_t i = 0; i < imgRT->getNumColorTextures(); ++i)
textures.push_back(imgRT->getColorTexture(i));
textures.push_back(imgRT->getColorTexture(i));
textures.push_back(imgRT->getDepthTexture());
}
else if (const ImageRepresentationGL* imgGL = img->getRepresentation<ImageRepresentationGL>()) {
textures.push_back(imgGL->getTexture());
}
}
}
......
......@@ -36,12 +36,11 @@
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/abstractimagerepresentation.h"
#include "core/datastructures/imagemappinginformation.h"
//#include "core/datastructures/imagerepresentationconverter.h"
//
#include <vector>
namespace campvis {
/**
* Stores basic information about one (semantic) image of arbitrary dimension.
* Different representations (e.g. local memory, OpenGL texture, OpenCL buffer) are
......@@ -157,15 +156,17 @@ namespace campvis {
/**
* Returns a representation of this image of type \a T.
* Looks, whether such a representations already exists, if not, tries to create one using
* the ImageRepresentationConverter. Returns 0 on failure.
* Looks, whether such a representations already exists, if not and \a performConversion is
* set, the method tries to create T::tryConvertFrom(). Returns 0 on failure.
* \note You do \b NOT have ownership of the returned pointer!
* The returned pointer is valid as long as this ImageData object exists.
* \note If \a T is OpenGL related, make sure to call this method from a valid and locked OpenGL context.
* \note The returned pointer is valid as long as this ImageData object exists.
* \return A pointer to a representation of type \a T, valid as long as this ImageData object exists.
* 0 if no such representation could be created.
* \param performConversion Flag whether to perform representation conversion if necessary.
* \return A pointer to a representation of type \a T, you do NOT have ownership, valid as long
* as this ImageData object exists. 0 if no such representation could be created.
*/
template<typename T>
const T* getRepresentation() const;
const T* getRepresentation(bool performConversion = true) const;
protected:
/**
......@@ -196,25 +197,31 @@ namespace campvis {
}
template<typename T>
const T* campvis::ImageData::getRepresentation() const {
const T* campvis::ImageData::getRepresentation(bool performConversion /*= true*/) const {
// look, whether we already have a suitable representation
for (std::vector<const AbstractImageRepresentation*>::iterator it = _representations.begin(); it != _representations.end(); ++it) {
if (typeid(T*) == typeid(*it)) {
return static_cast<const T*>(*it);
}
if (const T* tester = dynamic_cast<const T*>(*it))
return tester;
//if (typeid(T) == typeid(**it)) {
// return static_cast<const T*>(*it);
//}
}
// no representation found, create a new one
for (std::vector<const AbstractImageRepresentation*>::iterator it = _representations.begin(); it != _representations.end(); ++it) {
// const T* tester = ImageRepresentationConverter::tryConvert<T>(*it);
// if (tester != 0) {
// _representations.push_back(tester);
// return tester;
// }
if (performConversion) {
// no representation found, create a new one
for (std::vector<const AbstractImageRepresentation*>::iterator it = _representations.begin(); it != _representations.end(); ++it) {
const T* tester = T::tryConvertFrom(*it);// ImageRepresentationConverter::tryConvert<T>(*it);
if (tester != 0) {
_representations.push_back(tester);
return tester;
}
}
// could not create a suitable representation
LDEBUG("Could not create a " + std::string(typeid(T*).name()) + " representation.");
return 0;
}
// could not create a suitable representation
LDEBUG("Could not create a " + std::string(typeid(T*).name()) + " representation.");
return 0;
}
}
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// 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 HOLDER 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.
//
// ================================================================================================
#include "imagerepresentationconverter.h"
#include "core/datastructures/imagedata.h"
namespace campvis {
const std::string ImageRepresentationConverter::loggerCat_ = "CAMPVis.core.datastructures.ImageRepresentationConverter";
template<>
campvis::ImageRepresentationLocal* ImageRepresentationConverter::convert(const ImageRepresentationDisk* source) {
#define DISPATCH_CONVERSION(numChannels) \
if (source->getNumChannels() == (numChannels)) { \
switch (source->getBaseType()) { \
case WeaklyTypedPointer::UINT8: \
return convertToGenericLocal<uint8_t, (numChannels)>(source); \
case WeaklyTypedPointer::INT8: \
return convertToGenericLocal<int8_t, (numChannels)>(source); \
case WeaklyTypedPointer::UINT16: \
return convertToGenericLocal<uint16_t, (numChannels)>(source); \
case WeaklyTypedPointer::INT16: \
return convertToGenericLocal<int16_t, (numChannels)>(source); \
case WeaklyTypedPointer::UINT32: \
return convertToGenericLocal<uint32_t, (numChannels)>(source); \
case WeaklyTypedPointer::INT32: \
return convertToGenericLocal<int32_t, (numChannels)>(source); \
case WeaklyTypedPointer::FLOAT: \
return convertToGenericLocal<float, (numChannels)>(source); \
default: \
tgtAssert(false, "Should not reach this - wrong base data type!"); \
return 0; \
} \
}
DISPATCH_CONVERSION(1)
else DISPATCH_CONVERSION(2)
else DISPATCH_CONVERSION(3)
else DISPATCH_CONVERSION(4)
else {
tgtAssert(false, "Should not reach this - wrong number of channel!");
return 0;
}
}
template<>
campvis::ImageRepresentationGL* ImageRepresentationConverter::convert(const ImageRepresentationDisk* source) {
WeaklyTypedPointer wtp = source->getImageData();
ImageRepresentationGL* toReturn = new ImageRepresentationGL(source->getParent(), wtp);
delete wtp._pointer;
return toReturn;
}
template<>
campvis::ImageRepresentationGL* ImageRepresentationConverter::convert(const ImageRepresentationLocal* source) {
ImageRepresentationGL* toReturn = new ImageRepresentationGL(source->getParent(), source->getWeaklyTypedPointer());
return toReturn;
}
}
\ No newline at end of file
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// 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 HOLDER 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 IMAGEREPRESENTATIONCONVERTER_H__
#define IMAGEREPRESENTATIONCONVERTER_H__
#include "core/datastructures/genericimagerepresentationlocal.h"
#include "core/datastructures/imagerepresentationdisk.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/datastructures/imagerepresentationlocal.h"
#include <string>
namespace campvis {
/**
* Static class offering conversion between differen ImageRepresentation types
*/
struct ImageRepresentationConverter {
public:
/**
* Tries to convert \a source to \a TO ImageRepresentation type.
* \note Caller takes ownership of the created ImageRepresentation pointer.
* \tparam TO Target conversion type.
* \param source ImageRepresentation source for conversion.
* \return A pointer to the converted ImageRepresentation object, 0 if conversion failed.
*/
template<class TO>
static TO* tryConvert(const AbstractImageRepresentation* source);
/**
* Converts \a source to \a TO ImageRepresentation type.
* \note Caller takes ownership of the created ImageRepresentation pointer.
* \note Valid conversions have to be implemented using template specialization.
* \tparam FROM Source conversion type.
* \tparam TO Target conversion type.
* \param source ImageRepresentation source for conversion.
* \return A pointer to the converted ImageRepresentation object, 0 if conversion failed.
*/
template<class FROM, class TO>
static TO* convert(const FROM* source);
protected:
/**
* Helper function for creating a GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS> from an ImageRepresentationDisk
* \note Caller takes ownership of the created ImageRepresentation pointer.
* \tparam BASETYPE Image element base type
* \tparam NUMCHANNELS Number of channels per image element.
* \param source ImageRepresentation source for conversion.
* \return A pointer to the converted GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS> object, 0 if conversion failed.
*/
template<typename BASETYPE, size_t NUMCHANNELS>
static GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* convertToGenericLocal(const ImageRepresentationDisk* source);
static const std::string loggerCat_;
};
// ================================================================================================
template<class FROM, class TO>
TO* campvis::ImageRepresentationConverter::convert(const FROM* source) {
tgtAssert(false, "Conversion not implemented.");
return 0;
}
template<class TO>
TO* campvis::ImageRepresentationConverter::tryConvert(const AbstractImageRepresentation* source) {
if (source == 0)
return 0;
// test source image type via dynamic cast
if (const ImageRepresentationDisk* tester = dynamic_cast<const ImageRepresentationDisk*>(source)) {
return convert<ImageRepresentationDisk, TO>(tester);
}
if (const ImageRepresentationLocal* tester = dynamic_cast<const ImageRepresentationLocal*>(source)) {
return convert<ImageRepresentationLocal, TO>(tester);
}
return 0;
}
template<>
campvis::ImageRepresentationLocal* ImageRepresentationConverter::convert(const ImageRepresentationDisk* source);
template<>
campvis::ImageRepresentationGL* ImageRepresentationConverter::convert(const ImageRepresentationDisk* source);
template<>
campvis::ImageRepresentationGL* ImageRepresentationConverter::convert(const ImageRepresentationLocal* source);
template<typename BASETYPE, size_t NUMCHANNELS>
campvis::GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* campvis::ImageRepresentationConverter::convertToGenericLocal(const ImageRepresentationDisk* source) {
if (TypeTraits<BASETYPE, NUMCHANNELS>::basetypeSize != WeaklyTypedPointer::numBytes(source->getBaseType())) {
LERROR("Basetype size does not match.");
return 0;
}
if (NUMCHANNELS != source->getNumChannels()) {
LERROR("Number of channels does not match.");
return 0;
}
// TODO: check (un)signed int/float?
WeaklyTypedPointer wtp = source->getImageData();
GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* toReturn = new GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>(
source->getParent(),
reinterpret_cast<typename TypeTraits<BASETYPE, NUMCHANNELS>::ElementType*>(wtp._pointer));
return toReturn;
}
}
#endif // IMAGEREPRESENTATIONCONVERTER_H__
......@@ -52,13 +52,14 @@ namespace campvis {
ImageRepresentationDisk* ImageRepresentationDisk::getSubImage(const ImageData* parent, const tgt::svec3& llf, const tgt::svec3& urb) const {
tgtAssert(tgt::hand(tgt::lessThan(llf, urb)), "Coordinates in LLF must be component-wise smaller than the ones in URB!");
const tgt::svec3& size = getSize();
tgt::svec3 newSize = urb - llf;
if (newSize == getSize()) {
if (newSize == size) {
// nothing has changed, just provide a copy:
return clone();
}
size_t newOffset = _offset + WeaklyTypedPointer::numBytes(_type, _numChannels) * llf.x;
size_t newOffset = _offset + WeaklyTypedPointer::numBytes(_type, _numChannels) * (llf.x + llf.y * size.y + llf.z * size.x * size.y);
// the stride doesn't change!
tgt::svec3 newStride = (_stride == tgt::svec3::zero) ? getCanonicStride(getSize()) : _stride;
return new ImageRepresentationDisk(parent, _url, _type, _numChannels, newOffset, _endianess, newStride);
......@@ -214,4 +215,9 @@ namespace campvis {
return _numChannels;
}
ImageRepresentationDisk* ImageRepresentationDisk::tryConvertFrom(const AbstractImageRepresentation* source) {
// no conversion availible for now
return 0;
}
}
\ No newline at end of file
......@@ -70,6 +70,14 @@ namespace campvis {
*/
virtual ~ImageRepresentationDisk();
/**
* Performs a conversion of \a source to an ImageRepresentationLocal if feasible.
* Returns 0 if conversion was not successful or source representation type is not compatible.
* \note The caller has to take ownership of the returned pointer if not 0.
* \param source Source image representation for conversion.
* \return A pointer to a local representation of \a source or 0 on failure. The caller has to take ownership.
*/
static ImageRepresentationDisk* tryConvertFrom(const AbstractImageRepresentation* source);
//\see AbstractImageRepresentation::clone()
virtual ImageRepresentationDisk* clone() const;
......
......@@ -35,6 +35,8 @@
#include "tgt/tgt_gl.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagerepresentationdisk.h"
#include "core/datastructures/imagerepresentationlocal.h"
namespace campvis {
......@@ -57,6 +59,25 @@ namespace campvis {
delete _texture;
}
ImageRepresentationGL* ImageRepresentationGL::tryConvertFrom(const AbstractImageRepresentation* source) {
if (source == 0)
return 0;
// test source image type via dynamic cast
if (const ImageRepresentationDisk* tester = dynamic_cast<const ImageRepresentationDisk*>(source)) {
WeaklyTypedPointer wtp = tester->getImageData();
ImageRepresentationGL* toReturn = new ImageRepresentationGL(tester->getParent(), wtp);
delete wtp._pointer;
return toReturn;
}
else if (const ImageRepresentationLocal* tester = dynamic_cast<const ImageRepresentationLocal*>(source)) {
ImageRepresentationGL* toReturn = new ImageRepresentationGL(tester->getParent(), tester->getWeaklyTypedPointer());
return toReturn;
}
return 0;
}
ImageRepresentationGL* ImageRepresentationGL::clone() const {
GLubyte* data = _texture->downloadTextureToBuffer();
WeaklyTypedPointer wtp(WeaklyTypedPointer::baseType(_texture->getDataType()), WeaklyTypedPointer::numChannels(_texture->getFormat()), data);
......@@ -195,4 +216,5 @@ namespace campvis {
return _texture->getSizeOnGPU();
}
}
\ No newline at end of file
......@@ -82,6 +82,15 @@ namespace campvis {
*/
virtual ~ImageRepresentationGL();
/**
* Performs a conversion of \a source to an ImageRepresentationLocal if feasible.
* Returns 0 if conversion was not successful or source representation type is not compatible.
* \note The caller has to take ownership of the returned pointer if not 0.
* \param source Source image representation for conversion.
* \return A pointer to a local representation of \a source or 0 on failure. The caller has to take ownership.
*/
static ImageRepresentationGL* tryConvertFrom(const AbstractImageRepresentation* source);
/**
* \see AbstractImageRepresentation::clone()
......
......@@ -31,7 +31,8 @@
#include "tbb/include/tbb/tbb.h"
#include "tbb/include/tbb/spin_mutex.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagerepresentationdisk.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
#include <limits>
......@@ -108,6 +109,18 @@ namespace campvis {
delete _intensityHistogram;
}
ImageRepresentationLocal* ImageRepresentationLocal::tryConvertFrom(const AbstractImageRepresentation* source) {
if (source == 0)
return 0;
// test source image type via dynamic cast
if (const ImageRepresentationDisk* tester = dynamic_cast<const ImageRepresentationDisk*>(source)) {
return convertToGenericLocal(tester);
}
return 0;
}
const Interval<float>& ImageRepresentationLocal::getNormalizedIntensityRange() const {
if (_intensityRangeDirty)
computeNormalizedIntensityRange();
......@@ -138,4 +151,47 @@ namespace campvis {
tbb::parallel_for(tbb::blocked_range<size_t>(0, getNumElements()), IntensityHistogramGenerator(this, _intensityHistogram));
}
ImageRepresentationLocal* ImageRepresentationLocal::convertToGenericLocal(const ImageRepresentationDisk* source) {
WeaklyTypedPointer wtp = source->getImageData();
#define CONVERT_TO_GENERIC_LOCAL(baseType,numChannels) \
return new GenericImageRepresentationLocal<baseType, numChannels>( \
source->getParent(), \
reinterpret_cast< TypeTraits<baseType, numChannels>::ElementType*>(wtp._pointer));
#define DISPATCH_CONVERSION(numChannels) \
if (source->getNumChannels() == (numChannels)) { \
switch (source->getBaseType()) { \
case WeaklyTypedPointer::UINT8: \
CONVERT_TO_GENERIC_LOCAL(uint8_t, (numChannels)) \
case WeaklyTypedPointer::INT8: \
CONVERT_TO_GENERIC_LOCAL(int8_t, (numChannels)) \
case WeaklyTypedPointer::UINT16: \
CONVERT_TO_GENERIC_LOCAL(uint16_t, (numChannels)) \
case WeaklyTypedPointer::INT16: \
CONVERT_TO_GENERIC_LOCAL(int16_t, (numChannels)) \
case WeaklyTypedPointer::UINT32: \
CONVERT_TO_GENERIC_LOCAL(uint32_t, (numChannels)) \
case WeaklyTypedPointer::INT32: \
CONVERT_TO_GENERIC_LOCAL(int32_t, (numChannels)) \
case WeaklyTypedPointer::FLOAT: \
CONVERT_TO_GENERIC_LOCAL(float, (numChannels)) \
default: \
tgtAssert(false, "Should not reach this - wrong base data type!"); \
return 0; \
} \
}
DISPATCH_CONVERSION(1)
else DISPATCH_CONVERSION(2)
else DISPATCH_CONVERSION(3)
else DISPATCH_CONVERSION(4)
else {
tgtAssert(false, "Should not reach this - wrong number of channel!");
return 0;
}
}
}
\ No newline at end of file
......@@ -38,6 +38,7 @@
#include "core/tools/weaklytypedpointer.h"
namespace campvis {
class ImageRepresentationDisk;
/**
* Abstract base class for storing image data in the local memory.
......@@ -63,6 +64,15 @@ namespace campvis {
*/
virtual ~ImageRepresentationLocal();
/**
* Performs a conversion of \a source to an ImageRepresentationLocal if feasible.
* Returns 0 if conversion was not successful or source representation type is not compatible.
* \note The caller has to take ownership of the returned pointer if not 0.
* \param source Source image representation for conversion.
* \return A pointer to a local representation of \a source or 0 on failure. The caller has to take ownership.
*/
static ImageRepresentationLocal* tryConvertFrom(const AbstractImageRepresentation* source);
/// \see AbstractData::clone()
virtual ImageRepresentationLocal* clone() const = 0;
......@@ -201,6 +211,9 @@ namespace campvis {
static const std::string loggerCat_;
private:
static ImageRepresentationLocal* convertToGenericLocal(const ImageRepresentationDisk* source);
// We don't want this data to be copied - clone() must be enough
// (read: We are too lazy to implement a correct copy constructor / assignment-operator)
ImageRepresentationLocal(const ImageRepresentationLocal& rhs);
......
......@@ -318,4 +318,9 @@ namespace campvis {
return sum;
}
ImageRepresentationRenderTarget* ImageRepresentationRenderTarget::tryConvertFrom(const AbstractImageRepresentation* source) {
// no conversion availible for now
return 0;
}
}
\ No newline at end of file
......@@ -92,6 +92,15 @@ namespace campvis {
*/
virtual ~ImageRepresentationRenderTarget();
/**
* Performs a conversion of \a source to an ImageRepresentationLocal if feasible.
* Returns 0 if conversion was not successful or source representation type is not compatible.
* \note The caller has to take ownership of the returned pointer if not 0.
* \param source Source image representation for conversion.
* \return A pointer to a local representation of \a source or 0 on failure. The caller has to take ownership.
*/
static ImageRepresentationRenderTarget* tryConvertFrom(const AbstractImageRepresentation* source);
/// \see AbstractImageRepresentation::clone()
virtual ImageRepresentationRenderTarget* clone() const;
......
......@@ -36,7 +36,7 @@
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/datastructures/imagerepresentationrendertarget.h"
#include "core/datastructures/imagerepresentationconverter.h"
#include "core/classification/simpletransferfunction.h"