Added missing files and fixed GCC warnings.

parent 96dcb580
......@@ -60,15 +60,14 @@ namespace campvis {
cgtAssert(inputImage != nullptr, "Input image must not be 0!");
std::vector<cgt::vec3> vertices;
const cgt::ivec2 inputSize = inputImage->getSize().xy();
const cgt::ivec2& outputSize = p_targetSize.getValue();
const float rarara = cgt::PIf / 180.f;
Interval<float> fanAngles(p_angles.getValue().x * rarara, p_angles.getValue().y * rarara);
Interval<float> fanSize(p_lengths.getValue().x, p_lengths.getValue().y);
for (size_t y = 0; y < outputSize.y; ++y) {
float r = fanSize.getLeft() + static_cast<float>(outputSize.y - 1 -y) / static_cast<float>(outputSize.y) * fanSize.size();
for (int y = 0; y < outputSize.y; ++y) {
float r = fanSize.getLeft() + static_cast<float>(outputSize.y - 1 - y) / static_cast<float>(outputSize.y) * fanSize.size();
for (int x = 0; x < outputSize.x; ++x) {
float phi = fanAngles.getLeft() + (static_cast<float>(x) / static_cast<float>(outputSize.x) * fanAngles.size());
......
......@@ -29,7 +29,6 @@
#include "modules/cudaconfidencemaps/pipelines/cudaconfidencemapsworkflow.h"
#include "modules/cudaconfidencemaps/processors/cudaconfidencemapssolver.h"
#include "modules/cudaconfidencemaps/processors/usfanrenderer.h"
namespace campvis {
......@@ -39,6 +38,5 @@ namespace campvis {
template class WorkflowRegistrar<CudaConfidenceMapsWorkflow>;
template class SmartProcessorRegistrar<CudaConfidenceMapsSolver>;
template class SmartProcessorRegistrar<UsFanRenderer>;
}
\ No newline at end of file
......@@ -37,7 +37,7 @@
#include "modules/preprocessing/processors/glimagecrop.h"
#include "modules/preprocessing/processors/glimageresampler.h"
#include "modules/cudaconfidencemaps/processors/cudaconfidencemapssolver.h"
#include "modules/cudaconfidencemaps/processors/usfanrenderer.h"
#include "modules/vis/processors/usfanrenderer.h"
#include "modules/openigtlink/processors/openigtlinkclient.h"
#include "modules/advancedusvis/processors/advancedusfusion.h"
......
// ================================================================================================
//
// 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 "tools/texture2d.frag"
#include "tools/transferfunction.frag"
uniform sampler2D _texture;
uniform TextureParameters2D _textureParams;
uniform sampler1D _transferFunction;
uniform TFParameters1D _transferFunctionParams;
in vec3 ex_TexCoord;
out vec4 out_Color;
void main() {
vec4 sample = texture(_texture, vec2(ex_TexCoord.x, 1-ex_TexCoord.y));
if (_textureParams._numChannels == 1) {
out_Color = out_Color = lookupTF(_transferFunction, _transferFunctionParams, sample.r);
} else {
out_Color = sample;
}
}
// ================================================================================================
//
// 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.
//
// ================================================================================================
in vec3 in_Position; ///< incoming vertex position
in vec3 in_TexCoord; ///< incoming texture coordinate
out vec3 ex_TexCoord; ///< outgoing texture coordinate
/// Matrix defining projection transformation
uniform mat4 _projectionMatrix = mat4(
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
// Parameters defining fan geometry
uniform float halfAngle;
uniform float innerRadius;
void main() {
float radius = innerRadius + (1 - innerRadius) * in_Position.y;
vec4 pos = vec4(sin(halfAngle * in_Position.x*2) * radius,
cos(halfAngle * in_Position.x*2) * radius,
in_Position.z, 1);
gl_Position = _projectionMatrix * pos;
ex_TexCoord = in_TexCoord;
}
......@@ -29,6 +29,8 @@
#include "cgt/shadermanager.h"
#include "cgt/textureunit.h"
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/renderdata.h"
#include "core/datastructures/imagerepresentationgl.h"
......@@ -47,6 +49,7 @@ namespace campvis {
, p_text("Text", "Text", "Ultrasound Title")
, p_fontFileName("FontFileName", "Path to the Font File to Use", "", StringProperty::OPEN_FILENAME)
, p_fontSize("FontSize", "Font Size", 20, 4, 100)
, p_tf("TransferFunction", "Transfer Function", new Geometry1DTransferFunction(512, cgt::vec2(-1.f, 1.f)))
, _shader(0)
, _grid(nullptr)
{
......@@ -59,6 +62,8 @@ namespace campvis {
addProperty(p_fontFileName);
addProperty(p_fontSize);
addProperty(p_tf);
p_fontFileName.setValue(ShdrMgr.completePath("/modules/fontrendering/fonts/FreeSans.ttf"));
}
......@@ -67,12 +72,13 @@ namespace campvis {
void UsFanRenderer::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.load("modules/cudaconfidencemaps/glsl/usfanrenderer.vert", "modules/cudaconfidencemaps/glsl/usfanrenderer.frag", "");
_shader = ShdrMgr.load("modules/vis/glsl/usfanrenderer.vert", "modules/vis/glsl/usfanrenderer.frag", "");
// Creates the grid, with the origin at the center of the top edge, with the +y axis representing depth
_grid = GeometryDataFactory::createGrid(cgt::vec3(-0.5f, 1.0f, 0.0f), cgt::vec3(0.5f, 0.0f, 0.0f),
cgt::vec3(0.0f, 1.0f, 0.0f), cgt::vec3(1.0f, 0.0f, 0.0f),
32, 32);
static_cast<Geometry1DTransferFunction*>(p_tf.getTF())->addGeometry(TFGeometry1D::createHeatedBodyColorMap());
// Initialize font rendering
updateFontAtlas();
}
......@@ -121,11 +127,13 @@ namespace campvis {
viewportMatrix *= cgt::mat4::createTranslation(-bbCenter);
_shader->activate();
cgt::TextureUnit textureUnit;
cgt::TextureUnit textureUnit, tfUnit;
textureUnit.activate();
if (texture != nullptr)
texture->bind(_shader, textureUnit, "_texture", "_textureParams");
p_tf.getTF()->bind(_shader, tfUnit);
_shader->setUniform("_projectionMatrix", viewportMatrix);
_shader->setUniform("halfAngle", halfAngle);
_shader->setUniform("innerRadius", innerRadius);
......
......@@ -80,6 +80,8 @@ namespace campvis {
StringProperty p_fontFileName; ///< Path to the font file to use
IntProperty p_fontSize; ///< Font size to use
TransferFunctionProperty p_tf;
protected:
/// \see AbstractProcessor::updateResult
virtual void updateResult(DataContainer& dataContainer);
......
......@@ -48,6 +48,7 @@
#include "modules/vis/processors/sliceextractor.h"
#include "modules/vis/processors/slicerenderer2d.h"
#include "modules/vis/processors/slicerenderer3d.h"
#include "modules/vis/processors/usfanrenderer.h"
#include "modules/vis/processors/virtualmirrorcombine.h"
#include "modules/vis/processors/virtualmirrorgeometrygenerator.h"
#include "modules/vis/processors/volumeexplorer.h"
......@@ -79,6 +80,7 @@ namespace campvis {
template class SmartProcessorRegistrar<SliceExtractor>;
template class SmartProcessorRegistrar<SliceRenderer2D>;
template class SmartProcessorRegistrar<SliceRenderer3D>;
template class SmartProcessorRegistrar<UsFanRenderer>;
template class SmartProcessorRegistrar<VirtualMirrorCombine>;
template class SmartProcessorRegistrar<VirtualMirrorGeometryGenerator>;
template class SmartProcessorRegistrar<VolumeExplorer>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment