Commit aee5eb16 authored by Jakob Weiss's avatar Jakob Weiss
Browse files

Extended Params of glImageResampler and MedianFilter

parent dc64895d
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -43,13 +43,15 @@ namespace campvis {
        : VisualizationProcessor(viewportSizeProp)
        , p_inputImage("InputImage", "Input Image", "", DataNameProperty::READ)
        , p_outputImage("OutputImage", "Output Image", "GlImageResampler.out", DataNameProperty::WRITE)
        , p_resampleScale("ResampleScale", "Resampling Scale", .5f, .01f, 10.f)
        , p_relativeScale("RelativeScaling", "Relative Scaling", true)
        , p_resampleScale("ResampleScale", "Resampling Scale", cgt::vec3(.5f), cgt::vec3(.01f), cgt::vec3(10.f))
        , p_targetSize("TargetSize", "Size of Resampled Image", cgt::ivec3(128), cgt::ivec3(1), cgt::ivec3(1024))
        , _shader2D(0)
        , _shader3D(0)
    {
        addProperty(p_inputImage, INVALID_RESULT | INVALID_PROPERTIES);
        addProperty(p_outputImage);
        addProperty(p_relativeScale, INVALID_RESULT | INVALID_PROPERTIES);
        addProperty(p_resampleScale, INVALID_RESULT | INVALID_PROPERTIES);
        addProperty(p_targetSize);
    }
@@ -77,6 +79,9 @@ namespace campvis {
        if (img != 0) {
            cgt::vec3 originalSize(img->getSize());
            cgt::ivec3 resampledSize = p_targetSize.getValue();
            if (p_relativeScale.getValue())
                resampledSize = cgt::ivec3(p_resampleScale.getValue() * cgt::vec3(img->getSize()));

            bool isTexture2D = img->getParent()->getDimensionality() == 2;

            // 2D textures should not be scaled along the z axis
@@ -134,9 +139,12 @@ namespace campvis {
        ImageRepresentationGL::ScopedRepresentation img(dataContainer, p_inputImage.getValue());

        if (img != 0) {
            p_targetSize.setMaxValue(cgt::ivec3(img->getSize()) * int(p_resampleScale.getMaxValue()));
            p_targetSize.setMaxValue(cgt::ivec3(img->getSize()) * cgt::ivec3(p_resampleScale.getMaxValue()));
            if(p_relativeScale.getValue())
                p_targetSize.setValue(cgt::ivec3(cgt::vec3(img->getSize()) * p_resampleScale.getValue()));
        }
        p_resampleScale.setVisible(p_relativeScale.getValue());
        p_targetSize.setVisible(!p_relativeScale.getValue());
    }

}
+3 −1
Original line number Diff line number Diff line
@@ -75,7 +75,9 @@ namespace campvis {
        DataNameProperty p_inputImage;      ///< ID for input volume
        DataNameProperty p_outputImage;     ///< ID for output gradient volume

        FloatProperty p_resampleScale;      ///< Resampling Scale
        BoolProperty p_relativeScale;       ///< relative or absolute scaling

        Vec3Property p_resampleScale;      ///< Resampling Scale
        IVec3Property p_targetSize;         ///< Size of resampled image

    protected:
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ namespace campvis {
    MedianFilter::MedianFilter()
        : AbstractProcessor()
        , p_inputImage("InputImage", "Input Image", "", DataNameProperty::READ)
        , p_outputImage("OutputImage", "Output Image", "GlGaussianFilter.out", DataNameProperty::WRITE)
        , p_outputImage("OutputImage", "Output Image", "MedianFilter.out", DataNameProperty::WRITE)
        , p_windowSize("WindowSize", "Window Size", cgt::ivec3(1, 1, 0), cgt::ivec3(0), cgt::ivec3(30))
        , p_workgroupSize("WorkgroupSize", "Workgroup Size", cgt::ivec3(4), cgt::ivec3(1), cgt::ivec3(16))
        , _shader(0)