Commit ceaff5fb authored by Jakob Weiss's avatar Jakob Weiss

Necessary changes to get the default modules to build again

parent 22ef73e9
...@@ -194,8 +194,8 @@ namespace campvis { ...@@ -194,8 +194,8 @@ namespace campvis {
break; break;
// gather image // gather image
cgtAssert(dynamic_cast<const ImageData*>(_textures[index].getData()), "Found sth. else than ImageData in render texture vector. This should not happen!"); cgtAssert(_textures[index].getData<ImageData>(), "Found sth. else than ImageData in render texture vector. This should not happen!");
const ImageData* id = static_cast<const ImageData*>(_textures[index].getData()); auto id = _textures[index].getData<ImageData>();
// compute transformation matrices // compute transformation matrices
float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y); float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y);
...@@ -281,7 +281,7 @@ namespace campvis { ...@@ -281,7 +281,7 @@ namespace campvis {
if (texIndx < 0 || texIndx >= static_cast<int>(_textures.size())) if (texIndx < 0 || texIndx >= static_cast<int>(_textures.size()))
return; return;
const ImageData* id = static_cast<const ImageData*>(_textures[texIndx].getData()); auto id = _textures[texIndx].getData<ImageData>();
const cgt::Texture* tex = id->getRepresentation<ImageRepresentationGL>()->getTexture(); const cgt::Texture* tex = id->getRepresentation<ImageRepresentationGL>()->getTexture();
const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>(); const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>();
cgt::svec2 imageSize = id->getSize().xy(); cgt::svec2 imageSize = id->getSize().xy();
...@@ -394,13 +394,13 @@ namespace campvis { ...@@ -394,13 +394,13 @@ namespace campvis {
p_viewportSize.setValue(cgt::ivec2(width(), height())); p_viewportSize.setValue(cgt::ivec2(width(), height()));
for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) { for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
if (const ImageData* img = dynamic_cast<const ImageData*>(it->second.getData())) { if (auto img = it->second.getData<ImageData>()) {
if (const ImageRepresentationGL* imgGL = img->getRepresentation<ImageRepresentationGL>()) { if (const ImageRepresentationGL* imgGL = img->getRepresentation<ImageRepresentationGL>()) {
_textures.push_back(it->second); _textures.push_back(it->second);
maxSlices = std::max(maxSlices, imgGL->getTexture()->getDimensions().z); maxSlices = std::max(maxSlices, imgGL->getTexture()->getDimensions().z);
} }
} }
else if (const RenderData* rd = dynamic_cast<const RenderData*>(it->second.getData())) { else if (auto rd = it->second.getData<RenderData>()) {
for (size_t i = 0; i < rd->getNumColorTextures(); ++i) { for (size_t i = 0; i < rd->getNumColorTextures(); ++i) {
const ImageRepresentationGL* imgGL = rd->getColorTexture(i)->getRepresentation<ImageRepresentationGL>(); const ImageRepresentationGL* imgGL = rd->getColorTexture(i)->getRepresentation<ImageRepresentationGL>();
if (imgGL) { if (imgGL) {
...@@ -415,7 +415,7 @@ namespace campvis { ...@@ -415,7 +415,7 @@ namespace campvis {
} }
} }
else if (const GeometryData* gd = dynamic_cast<const GeometryData*>(it->second.getData())) { else if (auto gd = it->second.getData<GeometryData>()) {
std::string name = it->first.toStdString(); std::string name = it->first.toStdString();
// copy geometry over to local // copy geometry over to local
...@@ -481,7 +481,7 @@ namespace campvis { ...@@ -481,7 +481,7 @@ namespace campvis {
// check whether we have to render geometries // check whether we have to render geometries
cgt::Bounds unionBounds; cgt::Bounds unionBounds;
for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) { for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
if (const GeometryData* gd = dynamic_cast<const GeometryData*>(it->second.getData())) { if (auto gd = it->second.getData<GeometryData>()) {
unionBounds.addVolume(gd->getWorldBounds()); unionBounds.addVolume(gd->getWorldBounds());
} }
} }
......
...@@ -260,7 +260,7 @@ namespace campvis { ...@@ -260,7 +260,7 @@ namespace campvis {
QModelIndex idxName = index->sibling(index->row(), 0); QModelIndex idxName = index->sibling(index->row(), 0);
// only consider non-empty DataHandles // only consider non-empty DataHandles
if (handle.getData() != 0) { if (handle) {
handles.push_back(std::make_pair(idxName.data(Qt::DisplayRole).toString(), handle)); handles.push_back(std::make_pair(idxName.data(Qt::DisplayRole).toString(), handle));
_localFootprint += handle.getData()->getLocalMemoryFootprint(); _localFootprint += handle.getData()->getLocalMemoryFootprint();
_videoFootprint += handle.getData()->getVideoMemoryFootprint(); _videoFootprint += handle.getData()->getVideoMemoryFootprint();
...@@ -272,7 +272,7 @@ namespace campvis { ...@@ -272,7 +272,7 @@ namespace campvis {
_lblName->setText("Name: " + handles.front().first); _lblName->setText("Name: " + handles.front().first);
_lblTimestamp->setText("Timestamp: " + QString::number(handles.front().second.getTimestamp())); _lblTimestamp->setText("Timestamp: " + QString::number(handles.front().second.getTimestamp()));
if (const ImageData* tester = dynamic_cast<const ImageData*>(handles.front().second.getData())) { if (auto tester = handles.front().second.getData<ImageData>()) {
_canvas->p_transferFunction.setImageHandle(handles.front().second); _canvas->p_transferFunction.setImageHandle(handles.front().second);
_lblNumChannels->setText(tr("Number of Channels: ") + QString::number(tester->getNumChannels())); _lblNumChannels->setText(tr("Number of Channels: ") + QString::number(tester->getNumChannels()));
...@@ -294,7 +294,7 @@ namespace campvis { ...@@ -294,7 +294,7 @@ namespace campvis {
_canvas->p_renderAChannel.setVisible(true); _canvas->p_renderAChannel.setVisible(true);
_canvas->p_geometryRendererProperties.setVisible(false); _canvas->p_geometryRendererProperties.setVisible(false);
} }
else if (const GeometryData* tester = dynamic_cast<const GeometryData*>(handles.front().second.getData())) { else if (auto tester = handles.front().second.getData<GeometryData>()) {
_lblSize->setText(tr("Size: n/a")); _lblSize->setText(tr("Size: n/a"));
_lblNumChannels->setText(tr("Number of Channels: n/a")); _lblNumChannels->setText(tr("Number of Channels: n/a"));
...@@ -310,7 +310,7 @@ namespace campvis { ...@@ -310,7 +310,7 @@ namespace campvis {
_canvas->p_renderAChannel.setVisible(false); _canvas->p_renderAChannel.setVisible(false);
_canvas->p_geometryRendererProperties.setVisible(true); _canvas->p_geometryRendererProperties.setVisible(true);
} }
else if (const RenderData* tester = dynamic_cast<const RenderData*>(handles.front().second.getData())) { else if (auto tester = handles.front().second.getData<RenderData>()) {
const ImageData* id = tester->getNumColorTextures() > 0 ? tester->getColorTexture() : tester->getDepthTexture(); const ImageData* id = tester->getNumColorTextures() > 0 ? tester->getColorTexture() : tester->getDepthTexture();
if (id != 0) { if (id != 0) {
_lblNumChannels->setText(tr("Number of Channels: ") + QString::number(id->getNumChannels())); _lblNumChannels->setText(tr("Number of Channels: ") + QString::number(id->getNumChannels()));
...@@ -445,7 +445,7 @@ namespace campvis { ...@@ -445,7 +445,7 @@ namespace campvis {
// only consider non-empty DataHandles that are ImageData and have render target representations // only consider non-empty DataHandles that are ImageData and have render target representations
if (handle.getData() != 0) { if (handle.getData() != 0) {
if (dynamic_cast<const ImageData*>(handle.getData()) && dynamic_cast<const ImageData*>(handle.getData())->getDimensionality() == 3) { if (handle.getData<ImageData>() && handle.getData<ImageData>()->getDimensionality() == 3) {
QString dialogCaption = "Export " + name + " as MHD Image"; QString dialogCaption = "Export " + name + " as MHD Image";
QString directory = tr(""); QString directory = tr("");
const QString fileFilter = tr("*.mhd;;MHD images (*.mhd)"); const QString fileFilter = tr("*.mhd;;MHD images (*.mhd)");
...@@ -458,7 +458,7 @@ namespace campvis { ...@@ -458,7 +458,7 @@ namespace campvis {
writer.invalidate(AbstractProcessor::INVALID_RESULT); writer.invalidate(AbstractProcessor::INVALID_RESULT);
writer.process(*_dataContainer); writer.process(*_dataContainer);
} }
else if (dynamic_cast<const ImageData*>(handle.getData()) || dynamic_cast<const RenderData*>(handle.getData())) { else if (handle.getData<ImageData>() || handle.getData<RenderData>()) {
QString dialogCaption = "Export " + name + " as Image"; QString dialogCaption = "Export " + name + " as Image";
QString directory = tr(""); QString directory = tr("");
const QString fileFilter = tr("*.png;;PNG images (*.png)"); const QString fileFilter = tr("*.png;;PNG images (*.png)");
...@@ -484,10 +484,10 @@ namespace campvis { ...@@ -484,10 +484,10 @@ namespace campvis {
// get the ImageData object (either directly or from the RenderData) // get the ImageData object (either directly or from the RenderData)
const ImageData* id = 0; const ImageData* id = 0;
if (const RenderData* tester = dynamic_cast<const RenderData*>(handle.getData())) { if (auto tester = handle.getData<RenderData>()) {
id = tester->getColorTexture(0); id = tester->getColorTexture(0);
} }
else if (const ImageData* tester = dynamic_cast<const ImageData*>(handle.getData())) { else if (auto tester = handle.getData<ImageData>()) {
id = tester; id = tester;
} }
else { else {
......
...@@ -153,7 +153,7 @@ namespace campvis { ...@@ -153,7 +153,7 @@ namespace campvis {
DataHandle dh = prop->getImageHandle(); DataHandle dh = prop->getImageHandle();
if (dh.getData() != 0) { if (dh.getData() != 0) {
const ImageRepresentationLocal* idl = static_cast<const ImageData*>(dh.getData())->getRepresentation<ImageRepresentationLocal>(); const ImageRepresentationLocal* idl = dh.getData<ImageData>()->getRepresentation<ImageRepresentationLocal>();
if (idl != 0) { if (idl != 0) {
Interval<float> intensityInterval = idl->getNormalizedIntensityRange(); Interval<float> intensityInterval = idl->getNormalizedIntensityRange();
tf->setIntensityDomain(cgt::vec2(intensityInterval.getLeft(), intensityInterval.getRight())); tf->setIntensityDomain(cgt::vec2(intensityInterval.getLeft(), intensityInterval.getRight()));
......
...@@ -49,14 +49,14 @@ namespace campvis { ...@@ -49,14 +49,14 @@ namespace campvis {
size_t ImageSeries::getLocalMemoryFootprint() const { size_t ImageSeries::getLocalMemoryFootprint() const {
size_t toReturn = sizeof(DataHandle) * _images.capacity(); size_t toReturn = sizeof(DataHandle) * _images.capacity();
for (size_t i = 0; i < _images.size(); ++i) for (size_t i = 0; i < _images.size(); ++i)
toReturn += static_cast<const ImageData*>(_images[i].getData())->getLocalMemoryFootprint(); toReturn += _images[i].getData()->getLocalMemoryFootprint();
return toReturn; return toReturn;
} }
size_t ImageSeries::getVideoMemoryFootprint() const { size_t ImageSeries::getVideoMemoryFootprint() const {
size_t toReturn = 0; size_t toReturn = 0;
for (size_t i = 0; i < _images.size(); ++i) for (size_t i = 0; i < _images.size(); ++i)
toReturn += static_cast<const ImageData*>(_images[i].getData())->getVideoMemoryFootprint(); toReturn += _images[i].getData()->getVideoMemoryFootprint();
return toReturn; return toReturn;
} }
...@@ -65,7 +65,7 @@ namespace campvis { ...@@ -65,7 +65,7 @@ namespace campvis {
} }
void ImageSeries::addImage(DataHandle dh) { void ImageSeries::addImage(DataHandle dh) {
cgtAssert(dynamic_cast<const ImageData*>(dh.getData()) != 0, "DataHandle must contain ImageData!"); cgtAssert(dh.getData<ImageData>() != 0, "DataHandle must contain ImageData!");
_images.push_back(dh); _images.push_back(dh);
} }
...@@ -85,7 +85,7 @@ namespace campvis { ...@@ -85,7 +85,7 @@ namespace campvis {
cgt::Bounds ImageSeries::getWorldBounds() const { cgt::Bounds ImageSeries::getWorldBounds() const {
cgt::Bounds b; cgt::Bounds b;
for (size_t i = 0; i < _images.size(); ++i) { for (size_t i = 0; i < _images.size(); ++i) {
b.addVolume(static_cast<const ImageData*>(_images[i].getData())->getWorldBounds()); b.addVolume(_images[i].getData<ImageData>()->getWorldBounds());
} }
return b; return b;
} }
......
...@@ -101,12 +101,12 @@ namespace campvis { ...@@ -101,12 +101,12 @@ namespace campvis {
return _colorTextures.size(); return _colorTextures.size();
} }
const ImageData* RenderData::getColorTexture(size_t index /*= 0*/) const { ScopedTypedData<ImageData> RenderData::getColorTexture(size_t index /*= 0*/) const {
cgtAssert(index < _colorTextures.size(), "Index out of bounds."); cgtAssert(index < _colorTextures.size(), "Index out of bounds.");
if (index >= _colorTextures.size()) if (index >= _colorTextures.size())
return 0; return ScopedTypedData<ImageData>(DataHandle(nullptr), true);
return static_cast<const ImageData*>(_colorTextures[index].getData()); return _colorTextures[index].getData<ImageData>();
} }
campvis::DataHandle RenderData::getColorDataHandle(size_t index /*= 0*/) const { campvis::DataHandle RenderData::getColorDataHandle(size_t index /*= 0*/) const {
...@@ -121,12 +121,10 @@ namespace campvis { ...@@ -121,12 +121,10 @@ namespace campvis {
return _depthTexture.getData() != 0; return _depthTexture.getData() != 0;
} }
const ImageData* RenderData::getDepthTexture() const { ScopedTypedData<ImageData> RenderData::getDepthTexture() const {
const AbstractData* d = _depthTexture.getData(); auto d = _depthTexture.getData<ImageData>();
if (d == 0)
return 0;
return static_cast<const ImageData*>(d); return d;
} }
campvis::DataHandle RenderData::getDepthDataHandle() const { campvis::DataHandle RenderData::getDepthDataHandle() const {
...@@ -146,7 +144,7 @@ namespace campvis { ...@@ -146,7 +144,7 @@ namespace campvis {
if (index >= _colorTextures.size()) if (index >= _colorTextures.size())
return; return;
const ImageData* id = static_cast<const ImageData*>(_colorTextures[index].getData()); auto id = _colorTextures[index].getData<ImageData>();
cgtAssert(id != 0, "WTF, color texture with 0 pointer?!"); cgtAssert(id != 0, "WTF, color texture with 0 pointer?!");
const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true); const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true);
...@@ -158,7 +156,7 @@ namespace campvis { ...@@ -158,7 +156,7 @@ namespace campvis {
if (_depthTexture.getData() == 0) if (_depthTexture.getData() == 0)
return; return;
const ImageData* id = static_cast<const ImageData*>(_depthTexture.getData()); const ImageData* id = _depthTexture.getData<ImageData>();
const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true); const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true);
rep->bind(shader, depthTexUnit, depthTexUniform, texParamsUniform); rep->bind(shader, depthTexUnit, depthTexUniform, texParamsUniform);
} }
......
...@@ -89,7 +89,7 @@ namespace campvis { ...@@ -89,7 +89,7 @@ namespace campvis {
* \param index Index of the color texture to return. * \param index Index of the color texture to return.
* \return _colorTextures[index], 0 if index out of bounds. * \return _colorTextures[index], 0 if index out of bounds.
*/ */
const ImageData* getColorTexture(size_t index = 0) const; ScopedTypedData<ImageData> getColorTexture(size_t index = 0) const;
/** /**
* Gets the DataHandle with the color texture in this RenderData. * Gets the DataHandle with the color texture in this RenderData.
...@@ -109,7 +109,7 @@ namespace campvis { ...@@ -109,7 +109,7 @@ namespace campvis {
* Returns 0 if no depth texture is present. * Returns 0 if no depth texture is present.
* \return _depthTexture, may be 0. * \return _depthTexture, may be 0.
*/ */
const ImageData* getDepthTexture() const; ScopedTypedData<ImageData> getDepthTexture() const;
/** /**
* Gets the DataHandle with the depth texture in this RenderData, if present. * Gets the DataHandle with the depth texture in this RenderData, if present.
......
...@@ -64,11 +64,10 @@ namespace campvis { ...@@ -64,11 +64,10 @@ namespace campvis {
// try get Data // try get Data
DataHandle dh = _pipeline->getDataContainer().getData(_pipeline->getRenderTargetID()); DataHandle dh = _pipeline->getDataContainer().getData(_pipeline->getRenderTargetID());
const RenderData* rd = nullptr; ScopedTypedData<RenderData> rd(dh);
const ImageRepresentationGL* repGL = nullptr; const ImageRepresentationGL* repGL = nullptr;
if (dh.getData() != nullptr) { if (rd != nullptr) {
rd = dynamic_cast<const RenderData*>(dh.getData()); if (auto id = dh.getData<ImageData>())
if (const ImageData* id = dynamic_cast<const ImageData*>(dh.getData()))
repGL = id->getRepresentation<ImageRepresentationGL>(); repGL = id->getRepresentation<ImageRepresentationGL>();
} }
......
...@@ -162,7 +162,7 @@ namespace campvis { ...@@ -162,7 +162,7 @@ namespace campvis {
// we need an image as reference // we need an image as reference
if (_currentImage.getData() != nullptr) { if (_currentImage.getData() != nullptr) {
if (const ImageData* id = static_cast<const ImageData*>(_currentImage.getData())) { if (auto id = _currentImage.getData<ImageData>()) {
// we only handle mouse events // we only handle mouse events
if (cgt::MouseEvent* me = dynamic_cast<cgt::MouseEvent*>(e)) { if (cgt::MouseEvent* me = dynamic_cast<cgt::MouseEvent*>(e)) {
......
...@@ -98,11 +98,11 @@ namespace campvis { ...@@ -98,11 +98,11 @@ namespace campvis {
void TransferFunctionProperty::setImageHandle(DataHandle imageHandle) { void TransferFunctionProperty::setImageHandle(DataHandle imageHandle) {
cgtAssert( cgtAssert(
imageHandle.getData() == 0 || dynamic_cast<const ImageData*>(imageHandle.getData()) != 0, !imageHandle || imageHandle.getData<ImageData>(),
"The data in the image handle must either be 0 or point to a valid ImageData object!"); "The data in the image handle must either be 0 or point to a valid ImageData object!");
if (_autoFitWindowToData && imageHandle.getData() != 0) { if (_autoFitWindowToData && imageHandle.getData() != 0) {
if (const ImageData* id = dynamic_cast<const ImageData*>(imageHandle.getData())) { if (auto id = imageHandle.getData<ImageData>()) {
const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>(); const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>();
if (localRep != 0) { if (localRep != 0) {
const Interval<float>& ii = localRep->getNormalizedIntensityRange(); const Interval<float>& ii = localRep->getNormalizedIntensityRange();
......
...@@ -175,7 +175,7 @@ namespace campvis { ...@@ -175,7 +175,7 @@ namespace campvis {
std::vector<int> toReturn = std::vector<int>(p_histogram.getPredicateHistogram()->getPredicates().size(), 0); std::vector<int> toReturn = std::vector<int>(p_histogram.getPredicateHistogram()->getPredicates().size(), 0);
if (_bitmaskHandle.getData() != nullptr) { if (_bitmaskHandle.getData() != nullptr) {
const ImageData* id = static_cast<const ImageData*>(_bitmaskHandle.getData()); auto id = _bitmaskHandle.getData<ImageData>();
if (const GenericImageRepresentationLocal<BitmaskType, 1>* repLocal = id->getRepresentation< GenericImageRepresentationLocal<BitmaskType, 1> >()) { if (const GenericImageRepresentationLocal<BitmaskType, 1>* repLocal = id->getRepresentation< GenericImageRepresentationLocal<BitmaskType, 1> >()) {
// traverse all voxels and for each bitmask check each bit whether its set // traverse all voxels and for each bitmask check each bit whether its set
for (size_t i = 0; i < voxels.size(); ++i) { for (size_t i = 0; i < voxels.size(); ++i) {
......
...@@ -59,12 +59,11 @@ namespace campvis { ...@@ -59,12 +59,11 @@ namespace campvis {
void DevilImageWriter::updateResult(DataContainer& data) { void DevilImageWriter::updateResult(DataContainer& data) {
// try get Data // try get Data
DataHandle dh = data.getData(p_inputImage.getValue()); DataHandle dh = data.getData(p_inputImage.getValue());
const RenderData* rd = nullptr; ScopedTypedData<RenderData> rd(dh);
const ImageRepresentationLocal* repLocal = nullptr; const ImageRepresentationLocal* repLocal = nullptr;
if (dh.getData() != nullptr) { if (dh) {
rd = dynamic_cast<const RenderData*>(dh.getData()); if (auto id = dh.getData<ImageData>())
if (const ImageData* id = dynamic_cast<const ImageData*>(dh.getData()))
repLocal = id->getRepresentation<ImageRepresentationLocal>(); repLocal = id->getRepresentation<ImageRepresentationLocal>();
std::string filename = p_url.getValue(); std::string filename = p_url.getValue();
......
...@@ -235,8 +235,8 @@ namespace campvis { ...@@ -235,8 +235,8 @@ namespace campvis {
const GenericImageRepresentationLocal<float, 3>* evalRep = 0; const GenericImageRepresentationLocal<float, 3>* evalRep = 0;
const GenericImageRepresentationLocal<float, 9>* evecRep = 0; const GenericImageRepresentationLocal<float, 9>* evecRep = 0;
if (_eigenvalues.getData() != 0 && _eigenvectors.getData() != 0) { if (_eigenvalues.getData() != 0 && _eigenvectors.getData() != 0) {
evalRep = static_cast<const ImageData*>(_eigenvalues.getData())->getRepresentation< GenericImageRepresentationLocal<float, 3> >(false); evalRep = _eigenvalues.getData<ImageData>()->getRepresentation< GenericImageRepresentationLocal<float, 3> >(false);
evecRep = static_cast<const ImageData*>(_eigenvectors.getData())->getRepresentation< GenericImageRepresentationLocal<float, 9> >(false); evecRep = _eigenvectors.getData<ImageData>()->getRepresentation< GenericImageRepresentationLocal<float, 9> >(false);
} }
if (evalRep == 0 || evecRep == 0) { if (evalRep == 0 || evecRep == 0) {
LERROR("Could not compute output, no eigensystem present."); LERROR("Could not compute output, no eigensystem present.");
......
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