The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit a5c67131 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Implemented image conversion Disk -> GenericLocal if base type and number of channels matches

parent 634d2db1
......@@ -26,6 +26,7 @@
#define GENERICIMAGEREPRESENTATIONLOCAL_H__
#include "core/datastructures/imagerepresentationlocal.h"
#include "core/datastructures/imagerepresentationdisk.h"
#include "core/tools/typetraits.h"
#include <cstring> // needed for memcpy
......@@ -150,7 +151,7 @@ namespace campvis {
* \param data Pointer to the image data, must not be 0, GenericImageRepresentationLocal takes ownership of this pointer!
* \return A pointer to the newly created ImageRepresentationDisk, you do \b not own this pointer!
*/
static GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* create(ImageData* parent, ElementType* data);
static GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* create(const ImageData* parent, ElementType* data);
/**
* Destructor
......@@ -280,8 +281,8 @@ namespace campvis {
// = Template implementation ======================================================================
template<typename BASETYPE, size_t NUMCHANNELS>
campvis::GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* campvis::GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::create(ImageData* parent, ElementType* data) {
ThisType* toReturn = new ThisType(parent, data);
campvis::GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* campvis::GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::create(const ImageData* parent, ElementType* data) {
ThisType* toReturn = new ThisType(const_cast<ImageData*>(parent), data);
toReturn->addToParent();
return toReturn;
}
......@@ -306,6 +307,12 @@ namespace campvis {
template<typename BASETYPE, size_t NUMCHANNELS>
GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* campvis::GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::tryConvertFrom(const AbstractImageRepresentation* source) {
if (const ImageRepresentationDisk* tester = dynamic_cast<const ImageRepresentationDisk*>(source)) {
if (tester->getBaseType() == TypeTraits<BASETYPE, NUMCHANNELS>::weaklyTypedPointerBaseType && tester->getParent()->getNumChannels() == NUMCHANNELS) {
WeaklyTypedPointer wtp = tester->getImageData();
return create(tester->getParent(), static_cast<ElementType*>(wtp._pointer));
}
}
return 0;
}
......
......@@ -32,7 +32,7 @@ namespace campvis {
, _numChannels(numChannels)
, _pointer(ptr)
{
tgtAssert(_numChannels > 0 && _numChannels <= 4, "Number of channels out of bounds!");
tgtAssert(_numChannels > 0, "Number of channels out of bounds!");
};
WeaklyTypedPointer::WeaklyTypedPointer()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment