Commit 63d27593 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

introducing colored difference images to ReducerTest

parent a9af7d2c
......@@ -64,7 +64,7 @@ namespace campvis {
}
GlReduction::~GlReduction() {
ShdrMgr.dispose(_shader);
}
std::vector<float> GlReduction::reduce(const ImageData* image) {
......
......@@ -47,6 +47,8 @@ uniform vec2 _yClampRange;
uniform vec2 _zClampRange;
void main() {
float result = 0.0;
float difference = 0.0;
float sad = 0.0;
if ( ex_TexCoord.x >= _xClampRange.x && ex_TexCoord.x <= _xClampRange.y
......@@ -64,11 +66,12 @@ void main() {
movingValue = texture(_movingTexture, movingLookupTexCoord.xyz).a;
// compute differences
float difference = referenceValue - movingValue;
difference = referenceValue - movingValue;
sad = abs(difference);
//float ssd = difference * difference;
}
// write output color
out_Color = vec4(sad, sad, sad, sad);
result = difference;
out_Color = vec4(result, result, result, result);
}
......@@ -45,11 +45,13 @@ namespace campvis {
, _movingReader()
, _sm()
, _ve(&_canvasSize)
, _se(&_canvasSize)
{
addProcessor(&_referenceReader);
addProcessor(&_movingReader);
addProcessor(&_sm);
addProcessor(&_ve);
addProcessor(&_se);
addEventListenerToBack(&_ve);
}
......@@ -60,18 +62,32 @@ namespace campvis {
void ReducerTest::init() {
AutoEvaluationPipeline::init();
_referenceReader.p_url.setValue("D:/Medical Data/SCR/Data/RegSweeps_phantom_cropped/-1S3median/Volume_0.mhd");
_referenceReader.p_url.setValue("D:/Medical Data/SCR/Data/RegSweeps_phantom_cropped/-1S1median/Volume_2.mhd");
_referenceReader.p_targetImageID.setValue("Reference Image");
_referenceReader.p_targetImageID.addSharedProperty(&_sm.p_referenceId);
_movingReader.p_url.setValue("D:/Medical Data/SCR/Data/RegSweeps_phantom_cropped/-1S3median/Volume_1.mhd");
_movingReader.p_url.setValue("D:/Medical Data/SCR/Data/RegSweeps_phantom_cropped/-1S1median/Volume_3.mhd");
_movingReader.p_targetImageID.setValue("Moving Image");
_movingReader.p_targetImageID.addSharedProperty(&_sm.p_movingId);
_sm.p_differenceImageId.addSharedProperty(&_ve.p_inputVolume);
_sm.p_differenceImageId.addSharedProperty(&_se.p_sourceImageID);
_ve.p_outputImage.setValue("renderTarget");
_renderTargetID.setValue("renderTarget");
_ve.p_outputImage.setValue("volumeexplorer");
_se.p_targetImageID.setValue("sliceexplorer");
_renderTargetID.setValue("sliceexplorer");
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(-1.f, 1.f));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, .5f), tgt::col4(0, 0, 255, 255), tgt::col4(255, 255, 255, 0)));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(255, 255, 255, 0), tgt::col4(255, 0, 0, 255)));
MetaProperty* mp = static_cast<MetaProperty*>(_ve.getProperty("SliceExtractorProperties"));
static_cast<TransferFunctionProperty*>(mp->getProperty("transferFunction"))->replaceTF(dvrTF);
Geometry1DTransferFunction* seTF = new Geometry1DTransferFunction(128, tgt::vec2(-1.f, 1.f));
seTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, .5f), tgt::col4(0, 0, 255, 255), tgt::col4(255, 255, 255, 255)));
seTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(255, 255, 255, 255), tgt::col4(255, 0, 0, 255)));
_se.p_transferFunction.replaceTF(seTF);
}
void ReducerTest::onProcessorValidated(AbstractProcessor* processor) {
......
......@@ -75,6 +75,7 @@ namespace campvis {
SimilarityMeasure _sm;
VolumeExplorer _ve;
SliceExtractor _se;
};
......
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