Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

advancedusvis.cpp 6.02 KB
Newer Older
1
2
3
4
// ================================================================================================
// 
// This file is part of the CAMPVis Software Framework.
// 
5
// If not explicitly stated otherwise: Copyright (C) 2012-2015, all rights reserved,
6
7
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
//      Chair for Computer Aided Medical Procedures
8
9
//      Technische Universitaet Muenchen
//      Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
10
// 
11
12
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
// 
13
14
15
16
// 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
17
// 
18
19
20
21
// 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.
22
23
24
25
26
// 
// ================================================================================================

#include "advancedusvis.h"

27
#include "cgt/event/keyevent.h"
28

29
30
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
31
32
#include "core/datastructures/genericimagerepresentationlocal.h"

33
34
namespace campvis {

35
36
    AdvancedUsVis::AdvancedUsVis(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
37
38
        , _usReader()
        , _confidenceReader()
39
40
41
42
        , _usFusion1(&_canvasSize)
        , _usFusion2(&_canvasSize)
        , _usFusion3(&_canvasSize)
        , _usFusion4(&_canvasSize)
43
        , _usBlurFilter(&_canvasSize)
44
        , _quadView(&_canvasSize)
45
    {
46
47
        addProcessor(&_usReader);
        addProcessor(&_confidenceReader);
48
        addProcessor(&_usBlurFilter);
schultezub's avatar
schultezub committed
49
50
51
52
53
        addProcessor(&_usFusion1);
        addProcessor(&_usFusion2);
        addProcessor(&_usFusion3);
        addProcessor(&_usFusion4);
        addProcessor(&_quadView);
54
55
56
57
58
59
    }

    AdvancedUsVis::~AdvancedUsVis() {
    }

    void AdvancedUsVis::init() {
60
        AutoEvaluationPipeline::init();
61

62
        _usReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/us.mhd");
63
        _usReader.p_targetImageID.setValue("us.image");
64
65
66
67
        _usReader.p_targetImageID.addSharedProperty(&_usFusion1.p_usImageId);
        _usReader.p_targetImageID.addSharedProperty(&_usFusion2.p_usImageId);
        _usReader.p_targetImageID.addSharedProperty(&_usFusion3.p_usImageId);
        _usReader.p_targetImageID.addSharedProperty(&_usFusion4.p_usImageId);
68
69
70
        _usReader.p_targetImageID.addSharedProperty(&_usBlurFilter.p_inputImage);

        _confidenceReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/cm.mhd");
71
        _confidenceReader.p_targetImageID.setValue("confidence.image.read");
72
73
74
75
        _confidenceReader.p_targetImageID.addSharedProperty(&_usFusion1.p_confidenceImageID);
        _confidenceReader.p_targetImageID.addSharedProperty(&_usFusion2.p_confidenceImageID);
        _confidenceReader.p_targetImageID.addSharedProperty(&_usFusion3.p_confidenceImageID);
        _confidenceReader.p_targetImageID.addSharedProperty(&_usFusion4.p_confidenceImageID);
76

schultezub's avatar
schultezub committed
77
        _usFusion1.p_targetImageID.setValue("us.fused1");
78
        _usFusion1.p_targetImageID.addSharedProperty(&_quadView.p_inputImage1);
schultezub's avatar
schultezub committed
79
80
81
82
83
84
85
        _usFusion1.p_view.selectById("us");
        _usFusion1.p_sliceNumber.setValue(0);
        _usFusion1.p_sliceNumber.addSharedProperty(&_usFusion2.p_sliceNumber);
        _usFusion1.p_sliceNumber.addSharedProperty(&_usFusion3.p_sliceNumber);
        _usFusion1.p_sliceNumber.addSharedProperty(&_usFusion4.p_sliceNumber);

        _usFusion2.p_targetImageID.setValue("us.fused2");
86
        _usFusion2.p_targetImageID.addSharedProperty(&_quadView.p_inputImage2);
schultezub's avatar
schultezub committed
87
88
89
        _usFusion2.p_view.selectById("mappingSaturationHSV");

        _usFusion3.p_targetImageID.setValue("us.fused3");
90
        _usFusion3.p_targetImageID.addSharedProperty(&_quadView.p_inputImage3);
91
92
        _usFusion3.p_view.selectById("mappingLAB");
        _usFusion3.p_hue.setValue(0.22f);
schultezub's avatar
schultezub committed
93
94

        _usFusion4.p_targetImageID.setValue("us.fused4");
95
        _usFusion4.p_targetImageID.addSharedProperty(&_quadView.p_inputImage4);
schultezub's avatar
schultezub committed
96
        _usFusion4.p_view.selectById("mappingSharpness");
97

98
99
100
101
102
        _usBlurFilter.p_outputImage.setValue("us.blurred");
        _usBlurFilter.p_outputImage.addSharedProperty(&_usFusion1.p_blurredImageId);
        _usBlurFilter.p_outputImage.addSharedProperty(&_usFusion2.p_blurredImageId);
        _usBlurFilter.p_outputImage.addSharedProperty(&_usFusion3.p_blurredImageId);
        _usBlurFilter.p_outputImage.addSharedProperty(&_usFusion4.p_blurredImageId);
103
104
        _usBlurFilter.p_sigma.setValue(4.f);

schultezub's avatar
schultezub committed
105
106
        _quadView.p_outputImage.setValue("quadview.output");

107
108
        Geometry1DTransferFunction* tf = new Geometry1DTransferFunction(128, cgt::vec2(0.f, 1.f));
        tf->addGeometry(TFGeometry1D::createQuad(cgt::vec2(0.f, 1.f), cgt::col4(0, 0, 0, 255), cgt::col4(255, 255, 255, 255)));
schultezub's avatar
schultezub committed
109
        _usFusion1.p_transferFunction.replaceTF(tf);
110
111
112
        _usFusion2.p_transferFunction.replaceTF(tf->clone());
        _usFusion3.p_transferFunction.replaceTF(tf->clone());
        _usFusion4.p_transferFunction.replaceTF(tf->clone());
113

schultezub's avatar
schultezub committed
114
        _renderTargetID.setValue("quadview.output");
115
116
    }

117
    void AdvancedUsVis::deinit() {
118
        AutoEvaluationPipeline::deinit();
119
120
    }

121
    void AdvancedUsVis::keyEvent(cgt::KeyEvent* e) {
122
123
        if (e->pressed()) {
            switch (e->keyCode()) {
124
                case cgt::KeyEvent::K_UP:
schultezub's avatar
schultezub committed
125
                    _usFusion1.p_sliceNumber.increment();
126
                    break;
127
                case cgt::KeyEvent::K_DOWN:
schultezub's avatar
schultezub committed
128
                    _usFusion1.p_sliceNumber.decrement();
129
                    break;
130
131
                default:
                    break;
132
133
134
135
            }
        }
    }

136
}