2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

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

Fixed bug in DataContainerInspectorCanvas, improved ImageData representation conversion.

parent ccace339
......@@ -199,8 +199,8 @@ namespace campvis {
// compute transformation matrices
float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y);
float sliceRatio = (static_cast<float>(id->getSize().x) * id->getMappingInformation().getVoxelSize().x)
/ (static_cast<float>(id->getSize().y) * id->getMappingInformation().getVoxelSize().y);
float sliceRatio = (static_cast<float>(id->getSize().x) * std::abs(id->getMappingInformation().getVoxelSize().x))
/ (static_cast<float>(id->getSize().y) * std::abs(id->getMappingInformation().getVoxelSize().y));
float ratioRatio = sliceRatio / renderTargetRatio;
cgt::mat4 viewMatrix = (ratioRatio > 1) ? cgt::mat4::createScale(cgt::vec3(1.f, 1.f / ratioRatio, 1.f)) : cgt::mat4::createScale(cgt::vec3(ratioRatio, 1.f, 1.f));
......@@ -291,8 +291,8 @@ namespace campvis {
// compute transformation matrices
float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y);
float sliceRatio = (static_cast<float>(id->getSize().x) * id->getMappingInformation().getVoxelSize().x)
/ (static_cast<float>(id->getSize().y) * id->getMappingInformation().getVoxelSize().y);
float sliceRatio = (static_cast<float>(id->getSize().x) * std::abs(id->getMappingInformation().getVoxelSize().x))
/ (static_cast<float>(id->getSize().y) * std::abs(id->getMappingInformation().getVoxelSize().y));
float ratioRatio = sliceRatio / renderTargetRatio;
lookupTexelFloat /= (ratioRatio > 1) ? cgt::vec2(1.f, 1.f / ratioRatio) : cgt::vec2(ratioRatio, 1.f);
......
......@@ -215,7 +215,7 @@ namespace campvis {
template<typename T>
const T* campvis::ImageData::getRepresentation(bool performConversion) const {
// look, whether we already have a suitable representation
for (tbb::concurrent_vector<const AbstractImageRepresentation*>::const_iterator it = _representations.begin(); it != _representations.end(); ++it) {
for (auto it = _representations.rbegin(); it != _representations.rend(); ++it) {
if (const T* tester = dynamic_cast<const T*>(*it)) {
return tester;
}
......@@ -226,7 +226,7 @@ namespace campvis {
tbb::spin_mutex::scoped_lock lock(_conversionMutex);
// in the meantime, there something might have changed, so check again whether there is a new rep.
for (tbb::concurrent_vector<const AbstractImageRepresentation*>::const_iterator it = _representations.begin(); it != _representations.end(); ++it) {
for (auto it = _representations.rbegin(); it != _representations.rend(); ++it) {
if (const T* tester = dynamic_cast<const T*>(*it)) {
return tester;
}
......@@ -240,7 +240,7 @@ namespace campvis {
template<typename T>
const T* campvis::ImageData::tryPerformConversion() const {
for (tbb::concurrent_vector<const AbstractImageRepresentation*>::const_iterator it = _representations.begin(); it != _representations.end(); ++it) {
for (auto it = _representations.rbegin(); it != _representations.rend(); ++it) {
const T* tester = ImageRepresentationConverter::getRef().tryConvertFrom<T>(*it);
if (tester != 0) {
//LDEBUG("Performed a image representation conversion from " + std::string(typeid(**it).name()) + " to " + std::string(typeid(T).name()) + ".");
......
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