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

hierarchyrenderer.frag 4.43 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
25
26
27
// ================================================================================================
// 
// 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 Universitt Mnchen
//      Boltzmannstr. 3, 85748 Garching b. Mnchen, 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.
// 
// ================================================================================================

in vec3 ex_TexCoord;        ///< incoming texture coordinate
in vec4 ex_Position;        ///< incoming texture coordinate

28
out uvec4 result;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
#include "tools/texture2d.frag"
#include "tools/texture3d.frag"
#include "tools/transferfunction.frag"

// DRR volume
uniform sampler3D _volume;
uniform TextureParameters3D _volumeTextureParams;

// Transfer function
uniform sampler1D _transferFunction;
uniform TFParameters1D _transferFunctionParams;

uniform float _inverseTexSizeX; // 1.0 / mipmapLevelResolution
uniform float _inverseTexSizeY; // 1.0 / mipmapLevelResolution

45
46
47
48
uniform int _brickSize;
uniform int _brickDepth;
uniform vec3 _hierarchySize;
uniform vec2 _tfDomain;
49
50

void main() {
51
    result = uvec4(0);
52

53
54
55
56
57
58
59
    // For each element in the uvec4 bitmask:
    for (int e = 0; e < 4; ++e) {
        // For each bit of the uint value, the corresponding area in the volume is checked, whether it's transparent or not. The bits are set accordingly.
        for (int d = 0; d < 32; d++) {
            vec3 llf = vec3(gl_FragCoord.xy / _hierarchySize.xy, float((e * 32) + d + 0.5) / 128.0);
            //ivec3 llf = ivec3((gl_FragCoord.x - 0.5) * _brickSize, (gl_FragCoord.y - 0.5) * _brickSize, );
            bool hasData = false;
60

61
62
63
64
65
66
67
68
            /** 
             * For each bit _brickSize number of voxels in x and y direction and _brickDepth number of voxel in z-direction should be considered.
             * Also, to make sure that all voxels are considered, one offset voxel is considered in x, y, and z boundary from each side so that
             * each side will consider 2 more voxels.
             */
            for (int z = -1; z < _brickDepth + 1; ++z) {
                for (int y = -1; y < _brickSize + 1; ++y) {
                    for (int x = -1; x < _brickSize + 1; ++x) {
69
70
71
                        vec3 addendum = (vec3(x, y, z) / _volumeTextureParams._size);
                        vec3 texCoord = clamp(llf + addendum, 0.0, 1.0);
                        //float intensity = mapIntensityToTFDomain(_transferFunctionParams._intensityDomain, texture(_volume, texCoord).r);
72
73
74
75
76
                        ivec3 voxel = ivec3(texCoord * _volumeTextureParams._size);
                        float intensity = mapIntensityToTFDomain(_transferFunctionParams._intensityDomain, texelFetch(_volume, voxel, 0).r);
                        //float intensity = texture(_volume, voxel).r;
                        //vec4 color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
                        //if (color.a > 0) {
77
                        //}
78

79
80
                        // if there was any data in the volume data in that voxel, set the bit.
                        if (intensity >= _tfDomain.x && intensity <= _tfDomain.y) {
81
82
83
84
85
86
87
88
89
                            //result[e] |= (1 << d);
                            if (e == 0)
                                result.r |= (1 << d);
                            else if (e == 1)
                                result.g |= (1 << d);
                            else if (e == 2)
                                result.b |= (1 << d);
                            else if (e == 3)
                                result.a |= (1 << d);
90
91
92
93
                            break;
                        }
                    }
                }
94
95
96
97
            }
        }
    }
}