Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

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})
# Source files:
FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
modules/devil/processors/*.cpp
modules/devil/devil.cpp
modules/devil/processors/*.cpp
)
# 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 {
: AbstractImageReader()
, p_importType("ImportType", "Import Type", importOptions, 3)
, 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)
{
this->_ext.push_back("bmp");
......@@ -69,6 +70,7 @@ namespace campvis {
addProperty(p_targetImageID);
addProperty(p_importType);
addProperty(p_importSimilar);
addProperty(p_voxelSpacing);
}
DevilImageReader::~DevilImageReader() {
......@@ -94,6 +96,8 @@ namespace campvis {
size_t suffixPos = base.find_last_not_of("0123456789");
if (suffixPos != std::string::npos)
++suffixPos;
else if(!base.empty())
suffixPos = 0;
size_t suffixLength = (suffixPos == std::string::npos) ? 0 : base.length() - suffixPos;
// assemble the list of files to read
......@@ -243,7 +247,7 @@ namespace campvis {
if (p_importType.getOptionValue() == "rt") {
RenderData* rd = new RenderData();
rd->addColorTexture(id);
rd->addColorTexture(id);
// create fake depth image
ImageData* idDepth = new ImageData(dimensionality, imageSize, 1);
......@@ -256,6 +260,7 @@ namespace campvis {
data.addData(p_targetImageID.getValue(), rd);
}
else {
id->setMappingInformation(ImageMappingInformation(imageSize, cgt::vec3(0.0f), p_voxelSpacing.getValue()));
data.addData(p_targetImageID.getValue(), id);
}
}
......
......@@ -31,6 +31,7 @@
#include "core/properties/genericproperty.h"
#include "core/properties/optionproperty.h"
#include "core/properties/stringproperty.h"
#include "core/properties/numericproperty.h"
#include "modules/modulesapi.h"
#include "modules/io/processors/abstractimagereader.h"
......@@ -65,6 +66,11 @@ namespace campvis {
/// \see AbstractProcessor::deinit
virtual void deinit();
/**
* To be used in ProcessorFactory static methods
*/
static const std::string getId() { return "DevILImageReader"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "DevilImageReader"; };
/// \see AbstractProcessor::getDescription()
......@@ -76,6 +82,7 @@ namespace campvis {
GenericOptionProperty<std::string> p_importType;
BoolProperty p_importSimilar;
Vec3Property p_voxelSpacing;
protected:
/// \see AbstractProcessor::updateResult
......
......@@ -60,6 +60,11 @@ namespace campvis {
**/
virtual ~DevilImageWriter();
/**
* To be used in ProcessorFactory static methods
*/
static const std::string getId() { return "DevILImageWriter"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "DevilImageWriter"; };
/// \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