Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

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

Fixed conversion API to build also on GCC.

refs #474
refs #553
parent 3fc9a3ee
......@@ -5,8 +5,8 @@
// If not explicitly stated otherwise: Copyright (C) 2012-2013, 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
// 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".
//
......@@ -32,7 +32,6 @@
#include "core/tools/job.h"
namespace campvis {
namespace conversion {
ImageRepresentationGL* GlConversion::tryConvertFrom(const AbstractImageRepresentation* source) {
if (source == nullptr)
......@@ -108,4 +107,3 @@ namespace conversion {
}
}
}
......@@ -35,7 +35,6 @@
#include "core/datastructures/genericimagerepresentationlocal.h"
namespace campvis {
namespace conversion {
// = Declare converter classes ====================================================================
......@@ -79,11 +78,14 @@ namespace campvis {
template<typename BASETYPE, size_t NUMCHANNELS>
GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* GenericLocalConversion<BASETYPE, NUMCHANNELS>::tryConvertFrom(const AbstractImageRepresentation* source) {
typedef typename GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ElementType ElementType;
typedef typename GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ThisType ThisType;
if (const ImageRepresentationDisk* tester = dynamic_cast<const ImageRepresentationDisk*>(source)) {
// converting from disk representation
if (tester->getBaseType() == TypeTraits<BASETYPE, NUMCHANNELS>::weaklyTypedPointerBaseType && tester->getParent()->getNumChannels() == NUMCHANNELS) {
WeaklyTypedPointer wtp = tester->getImageData();
return GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::create(tester->getParent(), static_cast<GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ElementType*>(wtp._pointer));
return GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::create(tester->getParent(), static_cast<ElementType*>(wtp._pointer));
}
else {
LWARNINGC("CAMPVis.core.datastructures.GenericLocalConversion", "Could not convert since base type or number of channels mismatch.");
......@@ -99,12 +101,12 @@ namespace campvis {
WeaklyTypedPointer wtp = tester->getWeaklyTypedPointerConvert(TypeTraits<BASETYPE, NUMCHANNELS>::glDataType);
if (wtp._pointer != nullptr)
return GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::create(tester->getParent(), static_cast<GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ElementType*>(wtp._pointer));
return GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::create(tester->getParent(), static_cast<ElementType*>(wtp._pointer));
return nullptr;
}
else if (const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ThisType* tester = dynamic_cast<const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ThisType*>(source)) {
else if (const ThisType* tester = dynamic_cast<const ThisType*>(source)) {
// just to ensure that the following else if case is really a conversion
LDEBUGC("CAMPVis.core.datastructures.GenericLocalConversion", "Trying to convert into the same type - this should not happen, since it there is no conversion needed...");
return tester->clone(const_cast<ImageData*>(tester->getParent()));
......@@ -117,7 +119,7 @@ namespace campvis {
LDEBUGC("CAMPVis.core.datastructures.GenericLocalConversion", "Performing conversion between data types, you may lose information or the resulting data may show other unexpected features.");
size_t numElements = tester->getNumElements();
GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ElementType* newData = new GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>::ElementType[numElements];
ElementType* newData = new ElementType[numElements];
// traverse each channel of each element and convert the value
for (size_t i = 0; i < numElements; ++i) {
......@@ -139,7 +141,6 @@ namespace campvis {
return nullptr;
}
}
}
#endif // IMAGEREPRESENTATIONCONVERSIONCORE_H__
......@@ -30,6 +30,7 @@
#include "core/datastructures/facegeometry.h"
#include "core/datastructures/geometrydatafactory.h"
#include "core/datastructures/renderdata.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
#include "core/classification/simpletransferfunction.h"
#include "core/pipeline/processordecoratorbackground.h"
......
......@@ -26,6 +26,7 @@
#define GENERICIMAGEREPRESENTATIONITK_H__
#include "core/datastructures/abstractimagerepresentation.h"
#include "core/datastructures/imagedata.h"
#include "core/tools/weaklytypedpointer.h"
#include "modules/itk/core/itktypetraits.h"
......
......@@ -5,8 +5,8 @@
// If not explicitly stated otherwise: Copyright (C) 2012-2013, 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
// 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".
//
......@@ -30,7 +30,6 @@
#include "core/tools/opengljobprocessor.h"
namespace campvis {
namespace conversion {
ImageRepresentationGL* GlFromItkConversion::tryConvertFrom(const AbstractImageRepresentation* source) {
if (source == nullptr)
......@@ -100,4 +99,3 @@ namespace conversion {
}
}
}
......@@ -36,7 +36,6 @@
#include "modules/itk/core/genericimagerepresentationitk.h"
namespace campvis {
namespace conversion {
// = Declare converter classes ====================================================================
......@@ -129,7 +128,7 @@ namespace campvis {
}
template<typename BASETYPE, size_t NUMCHANNELS, size_t DIMENSIONALITY>
GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>* campvis::conversion::GenericItkConversion<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::tryConvertFrom(const AbstractImageRepresentation* source) {
GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>* campvis::GenericItkConversion<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::tryConvertFrom(const AbstractImageRepresentation* source) {
if (source == nullptr)
return nullptr;
......@@ -169,7 +168,7 @@ namespace campvis {
typename ItkImageType::Pointer itkImage = importer->GetOutput();
if (itkImage.IsNotNull())
return GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::ThisType::create(const_cast<ImageData*>(tester->getParent()), itkImage); // const_cast perfectly valid here
return GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::create(const_cast<ImageData*>(tester->getParent()), itkImage); // const_cast perfectly valid here
else
return nullptr;
}
......@@ -177,7 +176,6 @@ namespace campvis {
return nullptr;
}
}
}
#endif // IMAGEREPRESENTATIONCONVERSIONITK_H__
......@@ -24,14 +24,8 @@
#include "itkfilterdemo.h"
#include "tgt/event/keyevent.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/renderdata.h"
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
#include "core/tools/glreduction.h"
namespace campvis {
......
......@@ -26,15 +26,12 @@
#define ITKFILTERDEMO_H__
#include "core/pipeline/autoevaluationpipeline.h"
#include "core/properties/cameraproperty.h"
#include "modules/base/processors/lightsourceprovider.h"
#include "modules/io/processors/mhdimagereader.h"
#include "modules/preprocessing/processors/glimageresampler.h"
#include "modules/itk/processors/itkimagefilter.h"
#include "modules/vis/processors/volumeexplorer.h"
#include "core/tools/glreduction.h"
#include "modules/itk/processors/itkimagefilter.h"
namespace campvis {
class ItkFilterDemo : public AutoEvaluationPipeline {
......
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