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

advdvrvis.cpp 3.25 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ================================================================================================
// 
// This file is part of the CAMPVis Software Framework.
// 
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
//      Chair for Computer Aided Medical Procedures
//      Technische Universität München
//      Boltzmannstr. 3, 85748 Garching b. München, 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.
// 
// ================================================================================================

25
#include "advdvrvis.h"
26

27
#include "cgt/event/keyevent.h"
28
29
30
31
32
#include "core/datastructures/imagedata.h"

#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"

33
#include "modules/vis/processors/advoptimizedraycaster.h"
34

35
36
37
38
namespace campvis {

    AdvDVRVis::AdvDVRVis(DataContainer* dc)
        : AutoEvaluationPipeline(dc)
39
        , _lsp()
40
        , _imageReader()
41
        , _resampler(&_canvasSize)
42
        , _ve(&_canvasSize, new SliceExtractor(nullptr), new AdvOptimizedRaycaster(nullptr))
43
    {
44
        addEventListenerToBack(&_ve);
45

46
        addProcessor(&_lsp);
47
        addProcessor(&_imageReader);
48
        addProcessor(&_resampler);
49
        addProcessor(&_ve);
50
51
52
    }

    AdvDVRVis::~AdvDVRVis() {
53

54
55
56
57
58
    }

    void AdvDVRVis::init() {
        AutoEvaluationPipeline::init();

59
60
        _ve.p_outputImage.setValue("image.rendered");
        _renderTargetID.setValue("image.rendered");
61

62
        _imageReader.p_url.setValue(ShdrMgr.completePath("/modules/vis/sampledata/smallHeart.mhd"));
63
        _imageReader.p_targetImageID.setValue("image");
64
        _imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
65
66
67
        _imageReader.p_targetImageID.addSharedProperty(&_resampler.p_inputImage);

        _resampler.p_outputImage.setValue("image.resampled");
68

69
        Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, cgt::vec2(0.f, .05f));
70
71
        //dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(.12f, .15f), cgt::col4(85, 0, 0, 128), cgt::col4(255, 0, 0, 128)));
        //dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(.19f, .28f), cgt::col4(89, 89, 89, 155), cgt::col4(89, 89, 89, 155)));
72
        dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(.41f, .51f), cgt::col4(170, 170, 128, 64), cgt::col4(192, 192, 128, 64)));
73
74
        static_cast<TransferFunctionProperty*>(_ve.getNestedProperty("VolumeRendererProperties::RaycasterProps::TransferFunction"))->replaceTF(dvrTF);
        static_cast<FloatProperty*>(_ve.getNestedProperty("VolumeRendererProperties::RaycasterProps::SamplingRate"))->setValue(4.f);
75
76
77
    }

}