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

Slight improvements to the DevIL module

* improved filename pattern recognition
* added voxel spacing parameter
parent 4ba313be
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ IF(${ModuleEnabled})

    # Source files:
    FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
        modules/devil/devil.cpp
		modules/devil/processors/*.cpp
    )

+35 −0
Original line number Diff line number Diff line
// ================================================================================================
// 
// 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
+6 −1
Original line number Diff line number Diff line
@@ -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
@@ -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);
        }
    }
+7 −0
Original line number Diff line number Diff line
@@ -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
+5 −0
Original line number Diff line number Diff line
@@ -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()