Commit ab7a49dc authored by Kai Messerschmidt's avatar Kai Messerschmidt
Browse files

[CHANGE] Adept DVR for 2D TF. Make MIP available, deactivate Depth projection...

[CHANGE] Adept DVR for 2D TF. Make MIP available, deactivate Depth projection because I'm not sure how to implement it for the 2D TF
parent d5681429
......@@ -100,15 +100,6 @@ void WMDirectVolumeRendering2TF::connectors()
m_transferFunction = WModuleInputData< WDataSetSingle >::createAndAdd( shared_from_this(),
"transfer function data set 1",
"The 2D transfer function for the two data sets." );
// // The transfer function for our DVR
// m_transferFunction_ds0 = WModuleInputData< WDataSetSingle >::createAndAdd( shared_from_this(),
// "transfer function data set 1",
// "The 1D transfer function for the first data set." );
//
// // The transfer function for our DVR
// m_transferFunction_ds1 = WModuleInputData< WDataSetSingle >::createAndAdd( shared_from_this(),
// "transfer function data set 2",
// "The 1D transfer function for the second data set." );
// Optional: the gradient field
m_gradients = WModuleInputData< WDataSetVector >::createAndAdd( shared_from_this(),
......@@ -154,8 +145,8 @@ void WMDirectVolumeRendering2TF::properties()
m_maximumIntensityProjectionEnabled = m_improvementGroup->addProperty( "MIP", "If enabled, MIP is used.", false,
m_propCondition );
m_depthProjectionEnabled = m_improvementGroup->addProperty( "Depth projection", "If enabled, depth projection mode is used", false,
m_propCondition );
// m_depthProjectionEnabled = m_improvementGroup->addProperty( "Depth projection", "If enabled, depth projection mode is used", false,
// m_propCondition );
WModule::properties();
}
......@@ -220,11 +211,8 @@ void WMDirectVolumeRendering2TF::moduleMain()
WGEShaderDefineSwitch::SPtr opacityCorrectionEnableDefine = m_shader->setDefine( "OPACITYCORRECTION_ENABLED" );
WGEShaderDefineSwitch::SPtr maximumIntensityProjectionEnabledDefine = m_shader->setDefine( "MIP_ENABLED" );
WGEShaderDefineSwitch::SPtr depthProjectionEnabledDefine = m_shader->setDefine( "DEPTH_PROJECTION_ENABLED" );
//WGEShaderDefineSwitch::SPtr depthProjectionEnabledDefine = m_shader->setDefine( "DEPTH_PROJECTION_ENABLED" );
// the texture used for the transfer function
//osg::ref_ptr< osg::Image > tfImage_ds0 = new osg::Image();
//osg::ref_ptr< osg::Image > tfImage_ds1 = new osg::Image();
osg::ref_ptr< osg::Texture2D > tfTexture2D = new osg::Texture2D();
osg::ref_ptr< osg::Image > tfImage2D = new osg::Image();
......@@ -233,8 +221,6 @@ void WMDirectVolumeRendering2TF::moduleMain()
// let the main loop awake if the data changes or the properties changed.
m_moduleState.setResetable( true, true );
m_moduleState.add( m_transferFunction->getDataChangedCondition() );
// m_moduleState.add( m_transferFunction_ds0->getDataChangedCondition() );
// m_moduleState.add( m_transferFunction_ds1->getDataChangedCondition() );
m_moduleState.add( m_input_ds0->getDataChangedCondition() );
m_moduleState.add( m_input_ds1->getDataChangedCondition() );
m_moduleState.add( m_gradients->getDataChangedCondition() );
......@@ -268,7 +254,7 @@ void WMDirectVolumeRendering2TF::moduleMain()
std::shared_ptr< WDataSetScalar > dataSet1 = m_input_ds1->getData();
bool dataValid = ( dataSet0 != NULL ) && ( dataSet1 != NULL );
bool propUpdated = m_localIlluminationAlgo->changed() || m_stochasticJitterEnabled->changed() || m_opacityCorrectionEnabled->changed() ||
m_maximumIntensityProjectionEnabled->changed() || m_depthProjectionEnabled->changed();
m_maximumIntensityProjectionEnabled->changed(); // || m_depthProjectionEnabled->changed();
// reset module in case of invalid data. This accounts only for the scalar field input
......@@ -331,7 +317,6 @@ void WMDirectVolumeRendering2TF::moduleMain()
illuminationAlgoDefines->activateOption( m_localIlluminationAlgo->get( true ).getItemIndexOfSelected( 0 ) );
// if there is a gradient field available -> apply as texture too
// TODO(Kai): Depending on the approach, make this available later
std::shared_ptr< WDataSetVector > gradients = m_gradients->getData();
if( gradients )
{
......@@ -340,7 +325,6 @@ void WMDirectVolumeRendering2TF::moduleMain()
// bind the texture to the node
osg::ref_ptr< WDataTexture3D > gradTexture3D = gradients->getTexture();
wge::bindTexture( cube, gradTexture3D, 2, "u_gradients" );
//wge::bindTexture( cube, gradTexture3D, 1, "u_gradients_ds1" );
gradTexEnableDefine->setActive( true );
}
else
......@@ -351,7 +335,6 @@ void WMDirectVolumeRendering2TF::moduleMain()
////////////////////////////////////////////////////////////////////////////////////////////////////
// stochastic jittering texture
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO(Kai): Add jitter for second data set
// create some random noise
jitterSamplerDefine->setActive( false );
jitterEnable->setActive( false );
......@@ -362,7 +345,6 @@ void WMDirectVolumeRendering2TF::moduleMain()
randTexture->setFilterMinMag( osg::Texture2D::NEAREST );
randTexture->setWrapSTR( osg::Texture2D::REPEAT );
wge::bindTexture( cube, randTexture, 3, "u_jitter" );
//wge::bindTexture( cube, randTexture, 2, "u_jitter_ds1" );
jitterSamplerDefine->setActive( true );
jitterEnable->setActive( true );
jitterSizeXDefine->setValue( size );
......@@ -426,14 +408,14 @@ void WMDirectVolumeRendering2TF::moduleMain()
// depth projection
////////////////////////////////////////////////////////////////////////////////////////////////////
if( m_depthProjectionEnabled->get( true ) )
/*if( m_depthProjectionEnabled->get( true ) )
{
depthProjectionEnabledDefine->setActive( true );
}
else
{
depthProjectionEnabledDefine->setActive( false );
}
}*/
////////////////////////////////////////////////////////////////////////////////////////////////////
// setup all those uniforms
......
......@@ -172,7 +172,7 @@ private:
/**
* If active, color coding is done by depth projection mode where the intensity is taken from the alpha channel and the color from the color channel ( last part not implemented, yet )
*/
WPropBool m_depthProjectionEnabled;
//WPropBool m_depthProjectionEnabled;
/**
* A condition used to notify about changes in several properties.
......
/* XPM */
static const char * WMDirectVolumeRendering2TF_xpm[] = {
"32 32 602 2",
" c None",
". c #E5E5E5",
"+ c #E4E4E4",
"@ c #E3E3E3",
"# c #DDDCDC",
"$ c #DADADA",
"% c #DEDCDC",
"& c #E0E0E0",
"* c #DCDBDB",
"= c #C1BEBE",
"- c #A59696",
"; c #D0CDCD",
"> c #E6E6E6",
", c #D6D5D5",
"' c #A9A3A3",
") c #AEA4A4",
"! c #D6D4D4",
"~ c #DFDFDF",
"{ c #E2E3E3",
"] c #DCDCDC",
"^ c #D1D0D0",
"/ c #B8B4B4",
"( c #9C9090",
"_ c #918282",
": c #8E6868",
"< c #A99696",
"[ c #E1E2E2",
"} c #AFA6A6",
"| c #8B7373",
"1 c #9F8888",
"2 c #A28F8F",
"3 c #B1AAAA",
"4 c #D8D7D7",
"5 c #E3E4E4",
"6 c #BEB8B8",
"7 c #B3A8A8",
"8 c #A79F9F",
"9 c #938282",
"0 c #6B4A4A",
"a c #765858",
"b c #794141",
"c c #967777",
"d c #DFE1E1",
"e c #958989",
"f c #7D4040",
"g c #885252",
"h c #866868",
"i c #968787",
"j c #B2AAAA",
"k c #C2BEBE",
"l c #E2E2E2",
"m c #E3E2E2",
"n c #C6C5C5",
"o c #C3C1C1",
"p c #998A8A",
"q c #947979",
"r c #998686",
"s c #947D7D",
"t c #623737",
"u c #693C3C",
"v c #723636",
"w c #9D8383",
"x c #E7E9E9",
"y c #A09797",
"z c #6B3131",
"A c #7B3131",
"B c #774141",
"C c #815F5F",
"D c #988787",
"E c #A49999",
"F c #C1BDBD",
"G c #C5C2C2",
"H c #E1E1E1",
"I c #E5E6E6",
"J c #A09A9A",
"K c #A79A9A",
"L c #8A7777",
"M c #7C5656",
"N c #7E5D5D",
"O c #784B4B",
"P c #683D3D",
"Q c #754E4E",
"R c #6E3434",
"S c #936F6F",
"T c #8D7373",
"U c #5E2525",
"V c #724040",
"W c #794040",
"X c #824D4D",
"Y c #8B6B6B",
"Z c #8D6E6E",
"` c #968989",
" . c #A09393",
".. c #CFCECE",
"+. c #E1E0E0",
"@. c #BBB7B7",
"#. c #968888",
"$. c #856A6A",
"%. c #826666",
"&. c #6A3C3C",
"*. c #7B5050",
"=. c #836565",
"-. c #6D5050",
";. c #806060",
">. c #6F3838",
",. c #8D6C6C",
"'. c #D4D5D5",
"). c #816161",
"!. c #5F2727",
"~. c #774343",
"{. c #7D4C4C",
"]. c #7C3B3B",
"^. c #7E4C4C",
"/. c #7A4B4B",
"(. c #845B5B",
"_. c #8F7878",
":. c #AAA5A5",
"<. c #C5C1C1",
"[. c #D1D1D1",
"}. c #ACA4A4",
"|. c #8D7D7D",
"1. c #764747",
"2. c #753D3D",
"3. c #693333",
"4. c #7E5757",
"5. c #847070",
"6. c #7E6060",
"7. c #764C4C",
"8. c #672C2C",
"9. c #916C6C",
"0. c #D9DADA",
"a. c #836666",
"b. c #693F3F",
"c. c #755252",
"d. c #7C4F4F",
"e. c #7E4D4D",
"f. c #7B4141",
"g. c #773A3A",
"h. c #793C3C",
"i. c #825A5A",
"j. c #988D8D",
"k. c #B4AFAF",
"l. c #D3D1D1",
"m. c #AEA8A8",
"n. c #938484",
"o. c #836B6B",
"p. c #784545",
"q. c #743E3E",
"r. c #7C5353",
"s. c #8C7171",
"t. c #866E6E",
"u. c #856464",
"v. c #693737",
"w. c #885F5F",
"x. c #C8C7C7",
"y. c #7C4D4D",
"z. c #602B2B",
"A. c #886464",
"B. c #7D5A5A",
"C. c #835E5E",
"D. c #6C3A3A",
"E. c #6F2A2A",
"F. c #7B5454",
"G. c #917A7A",
"H. c #9F9494",
"I. c #B9B5B5",
"J. c #978989",
"K. c #795A5A",
"L. c #785656",
"M. c #764F4F",
"N. c #7D5656",
"O. c #8A6B6B",
"P. c #917B7B",
"Q. c #9F9595",
"R. c #8F8686",
"S. c #8E7C7C",
"T. c #815757",
"U. c #B6ADAD",
"V. c #724D4D",
"W. c #644040",
"X. c #7C6565",
"Y. c #9A8B8B",
"Z. c #806262",
"`. c #856B6B",
" + c #855959",
".+ c #703434",
"++ c #7D4D4D",
"@+ c #7C5050",
"#+ c #866969",
"$+ c #B0A7A7",
"%+ c #DDDDDD",
"&+ c #E6E7E7",
"*+ c #B7B2B2",
"=+ c #887777",
"-+ c #7A5654",
";+ c #775252",
">+ c #725959",
",+ c #8C7373",
"'+ c #8E7777",
")+ c #9E9292",
"!+ c #776969",
"~+ c #7E6666",
"{+ c #6E4343",
"]+ c #7E4E4E",
"^+ c #A69B9B",
"/+ c #6C4444",
"(+ c #603A3A",
"_+ c #7F5F5F",
":+ c #7E6C6C",
"<+ c #8A6C6C",
"[+ c #988989",
"}+ c #886969",
"|+ c #794242",
"1+ c #794646",
"2+ c #7E4545",
"3+ c #A99E9E",
"4+ c #C2C0C0",
"5+ c #9D8D8B",
"6+ c #838B9F",
"7+ c #754646",
"8+ c #7A5454",
"9+ c #755151",
"0+ c #846A6A",
"a+ c #897373",
"b+ c #897070",
"c+ c #775E5E",
"d+ c #847171",
"e+ c #703C3C",
"f+ c #7E5151",
"g+ c #908282",
"h+ c #6A3939",
"i+ c #725151",
"j+ c #7B5C5C",
"k+ c #8D7070",
"l+ c #7F6060",
"m+ c #6F3737",
"n+ c #753939",
"o+ c #764B4B",
"p+ c #8B6464",
"q+ c #AAA3A3",
"r+ c #D2D2D2",
"s+ c #C3BEBE",
"t+ c #907474",
"u+ c #7D595A",
"v+ c #6E4242",
"w+ c #783636",
"x+ c #6E3B3B",
"y+ c #755F5F",
"z+ c #A19494",
"A+ c #827171",
"B+ c #826969",
"C+ c #7F4E4E",
"D+ c #744A4A",
"E+ c #805656",
"F+ c #867575",
"G+ c #714747",
"H+ c #6A4C4C",
"I+ c #5F3D3D",
"J+ c #8C7070",
"K+ c #6F4B4B",
"L+ c #662F2F",
"M+ c #6E4646",
"N+ c #A9A0A0",
"O+ c #CCCACA",
"P+ c #877A7A",
"Q+ c #806565",
"R+ c #6E3D3D",
"S+ c #6D3535",
"T+ c #754D4D",
"U+ c #907D7D",
"V+ c #897777",
"W+ c #774D4D",
"X+ c #6D3A3A",
"Y+ c #6E4040",
"Z+ c #835858",
"`+ c #816C6C",
" @ c #613D3D",
".@ c #6A3838",
"+@ c #6A2929",
"@@ c #745656",
"#@ c #8C7676",
"$@ c #877070",
"%@ c #7A4545",
"&@ c #713737",
"*@ c #733D3D",
"=@ c #896A6A",
"-@ c #A39292",
";@ c #CDCBCB",
">@ c #CACACA",
",@ c #8D8484",
"'@ c #7A4747",
")@ c #6F4040",
"!@ c #7A5C5C",
"~@ c #8E8080",
"{@ c #967F7F",
"]@ c #683333",
"^@ c #642020",
"/@ c #795050",
"(@ c #8B7878",
"_@ c #663C3C",
":@ c #572020",
"<@ c #682828",
"[@ c #764242",
"}@ c #795353",
"|@ c #734F4F",
"1@ c #784444",
"2@ c #743030",
"3@ c #783C3C",
"4@ c #7A4E4E",
"5@ c #937474",
"6@ c #998383",
"7@ c #CCC9C9",
"8@ c #744D4D",
"9@ c #714646",
"0@ c #6E5151",
"a@ c #7D6F6F",
"b@ c #938585",
"c@ c #806464",
"d@ c #672F2F",
"e@ c #6D2727",
"f@ c #764545",
"g@ c #745757",
"h@ c #692F2F",
"i@ c #631717",
"j@ c #632C2C",
"k@ c #734545",
"l@ c #765454",
"m@ c #683737",
"n@ c #6F3B3B",
"o@ c #713A3A",
"p@ c #714444",
"q@ c #886868",
"r@ c #BDB9B9",
"s@ c #E2E1E1",
"t@ c #6D6D6D",
"u@ c #5F5E5E",
"v@ c #4A4545",
"w@ c #3E3434",
"x@ c #322121",
"y@ c #312020",
"z@ c #322424",
"A@ c #342222",
"B@ c #2F1D1D",
"C@ c #3A2B2B",
"D@ c #3D3131",
"E@ c #392C2C",
"F@ c #321414",
"G@ c #331111",
"H@ c #362424",
"I@ c #362929",
"J@ c #2D1414",
"K@ c #2E1111",
"L@ c #331616",
"M@ c #381F1F",
"N@ c #362020",
"O@ c #311C1C",
"P@ c #311717",
"Q@ c #311A1A",
"R@ c #341F1F",
"S@ c #3A2525",
"T@ c #413434",
"U@ c #4A4444",
"V@ c #626161",
"W@ c #636363",
"X@ c #494545",
"Y@ c #403939",
"Z@ c #3A2E2E",
"`@ c #382929",
" # c #3B2F2F",
".# c #302222",
"+# c #2C1717",
"@# c #342121",
"## c #342828",
"$# c #372121",
"%# c #321A1A",
"&# c #2D1313",
"*# c #361F1F",
"=# c #342323",
"-# c #2E1515",
";# c #2A1717",
"># c #311818",
",# c #341B1B",
"'# c #2E1313",
")# c #2F1515",
"!# c #341E1E",
"~# c #392121",
"{# c #3D2A2A",
"]# c #413535",
"^# c #514D4D",
"/# c #6C6C6C",
"(# c #666666",
"_# c #4D4949",
":# c #3C3333",
"<# c #372828",
"[# c #372929",
"}# c #332424",
"|# c #311919",
"1# c #2F1818",
"2# c #2D1818",
"3# c #301D1D",
"4# c #311616",
"5# c #301A1A",
"6# c #341C1C",
"7# c #352626",
"8# c #301C1C",
"9# c #2B1515",
"0# c #281414",
"a# c #301919",
"b# c #2C1616",
"c# c #2D1515",
"d# c #382626",
"e# c #382121",
"f# c #3E2D2D",
"g# c #3A2D2D",
"h# c #3F3636",
"i# c #575555",
"j# c #6B6B6B",
"k# c #01FD01",
"l# c #00FF00",
"m# c #02F501",
"n# c #0DC509",
"o# c #254719",
"p# c #2C1313",
"q# c #300D0D",
"r# c #07D903",
"s# c #227717",
"t# c #2F1010",
"u# c #352222",
"v# c #2B1414",
"w# c #05E503",
"x# c #1B530A",
"y# c #00FC00",
"z# c #00FD00",
"A# c #04EE02",
"B# c #14BC10",
"C# c #495D46",
"D# c #17C716",
"E# c #13C310",
"F# c #08D906",
"G# c #02F102",
"H# c #263114",
"I# c #2A0B0B",
"J# c #158907",
"K# c #0CB606",
"L# c #2B1010",
"M# c #311B1B",
"N# c #362323",
"O# c #254210",
"P# c #03F002",
"Q# c #2B140F",
"R# c #0DB504",
"S# c #0FB909",
"T# c #11BF0D",
"U# c #05E703",
"V# c #19CC19",
"W# c #666565",
"X# c #413E3A",
"Y# c #403636",
"Z# c #3C3434",
"`# c #1AA716",
" $ c #12A40B",
".$ c #2C1515",
"+$ c #213A0D",
"@$ c #01F600",
"#$ c #2B1A10",
"$$ c #351D1D",
"%$ c #362222",
"&$ c #178909",
"*$ c #10A506",
"=$ c #2C1A1A",
"-$ c #2E2723",
";$ c #383030",
">$ c #3E3A3A",
",$ c #303B23",
"'$ c #01FB01",
")$ c #646D63",
"!$ c #4D4F4B",
"~$ c #433E3E",
"{$ c #382D2D",
"]$ c #40523C",
"^$ c #05E903",
"/$ c #2F1919",
"($ c #07DC03",
"_$ c #2A7322",
":$ c #3E2E2E",
"<$ c #3A2A2A",
"[$ c #0AD507",
"}$ c #245F14",
"|$ c #321B1B",
"1$ c #403E3A",
"2$ c #444040",
"3$ c #403737",
"4$ c #07EE07",
"5$ c #627B62",
"6$ c #616561",
"7$ c #5D5C5C",
"8$ c #453F3F",
"9$ c #04EE03",
"0$ c #292315",
"a$ c #1E9D18",
"b$ c #19B816",
"c$ c #443D3D",
"d$ c #3C5236",
"e$ c #03F202",
"f$ c #403933",