In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

Commit 923f47db authored by Jakob Weiss's avatar Jakob Weiss

Slight improvements to the DevIL module

* improved filename pattern recognition
* added voxel spacing parameter
parent 4ba313be
...@@ -54,7 +54,8 @@ IF(${ModuleEnabled}) ...@@ -54,7 +54,8 @@ IF(${ModuleEnabled})
# Source files: # Source files:
FILE(GLOB ThisModSources RELATIVE ${ModulesDir} FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
modules/devil/processors/*.cpp modules/devil/devil.cpp
modules/devil/processors/*.cpp
) )
# Header files # Header files
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2015, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#include "core/pipeline/processorfactory.h"
#include "modules/devil/processors/devilimagereader.h"
#include "modules/devil/processors/devilimagewriter.h"
namespace campvis {
template class SmartProcessorRegistrar<DevilImageReader>;
template class SmartProcessorRegistrar<DevilImageWriter>;
}
\ No newline at end of file
...@@ -57,6 +57,7 @@ namespace campvis { ...@@ -57,6 +57,7 @@ namespace campvis {
: AbstractImageReader() : AbstractImageReader()
, p_importType("ImportType", "Import Type", importOptions, 3) , p_importType("ImportType", "Import Type", importOptions, 3)
, p_importSimilar("ImportSimilar", "Import All Similar Files", false) , p_importSimilar("ImportSimilar", "Import All Similar Files", false)
, p_voxelSpacing("VoxelSpacing", "Pixel/Voxel Spacing", cgt::vec3(1.0f), cgt::vec3(0.0f), cgt::vec3(1e9f))
, _shader(nullptr) , _shader(nullptr)
{ {
this->_ext.push_back("bmp"); this->_ext.push_back("bmp");
...@@ -69,6 +70,7 @@ namespace campvis { ...@@ -69,6 +70,7 @@ namespace campvis {
addProperty(p_targetImageID); addProperty(p_targetImageID);
addProperty(p_importType); addProperty(p_importType);
addProperty(p_importSimilar); addProperty(p_importSimilar);
addProperty(p_voxelSpacing);
} }
DevilImageReader::~DevilImageReader() { DevilImageReader::~DevilImageReader() {
...@@ -94,6 +96,8 @@ namespace campvis { ...@@ -94,6 +96,8 @@ namespace campvis {
size_t suffixPos = base.find_last_not_of("0123456789"); size_t suffixPos = base.find_last_not_of("0123456789");
if (suffixPos != std::string::npos) if (suffixPos != std::string::npos)
++suffixPos; ++suffixPos;
else if(!base.empty())
suffixPos = 0;
size_t suffixLength = (suffixPos == std::string::npos) ? 0 : base.length() - suffixPos; size_t suffixLength = (suffixPos == std::string::npos) ? 0 : base.length() - suffixPos;
// assemble the list of files to read // assemble the list of files to read
...@@ -243,7 +247,7 @@ namespace campvis { ...@@ -243,7 +247,7 @@ namespace campvis {
if (p_importType.getOptionValue() == "rt") { if (p_importType.getOptionValue() == "rt") {
RenderData* rd = new RenderData(); RenderData* rd = new RenderData();
rd->addColorTexture(id); rd->addColorTexture(id);
// create fake depth image // create fake depth image
ImageData* idDepth = new ImageData(dimensionality, imageSize, 1); ImageData* idDepth = new ImageData(dimensionality, imageSize, 1);
...@@ -256,6 +260,7 @@ namespace campvis { ...@@ -256,6 +260,7 @@ namespace campvis {
data.addData(p_targetImageID.getValue(), rd); data.addData(p_targetImageID.getValue(), rd);
} }
else { else {
id->setMappingInformation(ImageMappingInformation(imageSize, cgt::vec3(0.0f), p_voxelSpacing.getValue()));
data.addData(p_targetImageID.getValue(), id); data.addData(p_targetImageID.getValue(), id);
} }
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "core/properties/genericproperty.h" #include "core/properties/genericproperty.h"
#include "core/properties/optionproperty.h" #include "core/properties/optionproperty.h"
#include "core/properties/stringproperty.h" #include "core/properties/stringproperty.h"
#include "core/properties/numericproperty.h"
#include "modules/modulesapi.h" #include "modules/modulesapi.h"
#include "modules/io/processors/abstractimagereader.h" #include "modules/io/processors/abstractimagereader.h"
...@@ -65,6 +66,11 @@ namespace campvis { ...@@ -65,6 +66,11 @@ namespace campvis {
/// \see AbstractProcessor::deinit /// \see AbstractProcessor::deinit
virtual void deinit(); virtual void deinit();
/**
* To be used in ProcessorFactory static methods
*/
static const std::string getId() { return "DevILImageReader"; };
/// \see AbstractProcessor::getName() /// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "DevilImageReader"; }; virtual const std::string getName() const { return "DevilImageReader"; };
/// \see AbstractProcessor::getDescription() /// \see AbstractProcessor::getDescription()
...@@ -76,6 +82,7 @@ namespace campvis { ...@@ -76,6 +82,7 @@ namespace campvis {
GenericOptionProperty<std::string> p_importType; GenericOptionProperty<std::string> p_importType;
BoolProperty p_importSimilar; BoolProperty p_importSimilar;
Vec3Property p_voxelSpacing;
protected: protected:
/// \see AbstractProcessor::updateResult /// \see AbstractProcessor::updateResult
......
...@@ -60,6 +60,11 @@ namespace campvis { ...@@ -60,6 +60,11 @@ namespace campvis {
**/ **/
virtual ~DevilImageWriter(); virtual ~DevilImageWriter();
/**
* To be used in ProcessorFactory static methods
*/
static const std::string getId() { return "DevILImageWriter"; };
/// \see AbstractProcessor::getName() /// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "DevilImageWriter"; }; virtual const std::string getName() const { return "DevilImageWriter"; };
/// \see AbstractProcessor::getDescription() /// \see AbstractProcessor::getDescription()
......
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