Skip to content

Commit

Permalink
fixed 64 bits flag in fibersgroup to allow 64 bit to build (remove fo…
Browse files Browse the repository at this point in the history
…rced INT_MAX). also added slice fiber option to complement TDI (only works with use geometry)
  • Loading branch information
chamberm committed Jun 27, 2017
1 parent a52e606 commit 15df08d
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 11 deletions.
62 changes: 58 additions & 4 deletions src/dataset/Fibers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Fibers::Fibers()
m_coronalShown( SceneManager::getInstance()->isCoronalDisplayed() ),
m_sagittalShown( SceneManager::getInstance()->isSagittalDisplayed() ),
m_useIntersectedFibers( false ),
m_useSliceFibers( false ),
m_thickness( 2.5f ),
m_tubeRadius( 3.175f ),
m_xDrawn( 0.0f ),
Expand All @@ -101,6 +102,7 @@ Fibers::Fibers()
m_pToggleNormalColoring( NULL ),
m_pSelectConstantFibersColor( NULL ),
m_pToggleCrossingFibers( NULL ),
m_pToggleSliceFibers( NULL ),
m_pRadNormalColoring( NULL ),
m_pRadDistanceAnchoring( NULL ),
m_pRadMinDistanceAnchoring( NULL ),
Expand Down Expand Up @@ -3114,7 +3116,7 @@ void Fibers::draw()
return;
}

if( m_useTransparency && !m_useIntersectedFibers )
if( m_useTransparency && !m_useIntersectedFibers && !m_useSliceFibers )
{
glPushAttrib( GL_ALL_ATTRIB_BITS );
glEnable( GL_BLEND );
Expand All @@ -3127,7 +3129,7 @@ void Fibers::draw()

// If geometry shaders are supported, the shader will take care of the filtering
// Otherwise, use the drawCrossingFibers
if ( !SceneManager::getInstance()->isFibersGeomShaderActive() && m_useIntersectedFibers )
if ( !SceneManager::getInstance()->isFibersGeomShaderActive() && m_useIntersectedFibers && !m_useSliceFibers )
{
if( m_useTransparency )
{
Expand Down Expand Up @@ -3931,7 +3933,9 @@ void Fibers::createPropertiesSizer( PropertiesWindow *pParent )
m_pToggleLocalColoring = new wxToggleButton( pParent, wxID_ANY, wxT( "Local Coloring" ) );
m_pToggleNormalColoring = new wxToggleButton( pParent, wxID_ANY, wxT( "Color With Overlay" ) );
m_pSelectConstantFibersColor = new wxButton( pParent, wxID_ANY, wxT( "Select Constant Color..." ) );
m_pToggleCrossingFibers = new wxToggleButton( pParent, wxID_ANY, wxT( "Intersected Fibers" ) );
m_pToggleCrossingFibers = new wxToggleButton( pParent, wxID_ANY, wxT( "TDI Fibers" ) );
m_pToggleSliceFibers = new wxToggleButton( pParent, wxID_ANY, wxT( "Slice Fibers" ) );
m_pToggleSliceFibers->Enable(false);
m_pRadNormalColoring = new wxRadioButton( pParent, wxID_ANY, wxT( "Normal" ), DEF_POS, DEF_SIZE, wxRB_GROUP );

#if !_USE_LIGHT_GUI
Expand Down Expand Up @@ -4022,6 +4026,7 @@ void Fibers::createPropertiesSizer( PropertiesWindow *pParent )
//////////////////////////////////////////////////////////////////////////

pBoxMain->Add( m_pToggleCrossingFibers, 0, wxEXPAND | wxLEFT | wxRIGHT, 24 );
pBoxMain->Add(m_pToggleSliceFibers,0, wxEXPAND | wxLEFT | wxRIGHT, 24 );

#if !_USE_LIGHT_GUI
pBoxMain->Add( pBtnGeneratesDensityVolume, 0, wxEXPAND | wxLEFT | wxRIGHT, 24 );
Expand Down Expand Up @@ -4095,6 +4100,7 @@ void Fibers::createPropertiesSizer( PropertiesWindow *pParent )
pParent->Connect( m_pToggleNormalColoring->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxEventHandler( PropertiesWindow::OnToggleShowFS ) );
pParent->Connect( m_pSelectConstantFibersColor->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PropertiesWindow::OnSelectConstantColor ) );
pParent->Connect( m_pToggleCrossingFibers->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxEventHandler( PropertiesWindow::OnToggleCrossingFibers ) );
pParent->Connect( m_pToggleSliceFibers->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxEventHandler( PropertiesWindow::OnToggleSliceFibers ) );
pParent->Connect( m_pRadNormalColoring->GetId(), wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PropertiesWindow::OnNormalColoring ) );

#if !_USE_LIGHT_GUI
Expand Down Expand Up @@ -4130,7 +4136,8 @@ void Fibers::updatePropertiesSizer()
m_pSliderOpacity->Enable( false );
m_pSliderInterFibersThickness->Enable( m_useIntersectedFibers );
m_pToggleFiltering->Enable( false );
m_pToggleCrossingFibers->Enable( true );
//m_pToggleCrossingFibers->Enable( true );
m_pToggleSliceFibers->Enable( SceneManager::getInstance()->isFibersGeomShaderActive() && !m_useIntersectedFibers);
m_pRadNormalColoring->Enable( getShowFS() );

#if !_USE_LIGHT_GUI
Expand All @@ -4144,6 +4151,7 @@ void Fibers::updatePropertiesSizer()

m_pToggleFiltering->SetValue( false );
m_pToggleCrossingFibers->SetValue( m_useIntersectedFibers );
m_pToggleSliceFibers->SetValue(m_useSliceFibers);
m_pSliderOpacity->SetValue( m_pSliderOpacity->GetMin() );
m_pToggleNormalColoring->SetValue( !getShowFS() );
m_pSliderThresholdIntensity->SetValue( getThreshold() * 100 );
Expand Down Expand Up @@ -4385,6 +4393,34 @@ void Fibers::setShader()

ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("zMin", SceneManager::getInstance()->isAxialDisplayed() ? zMin : 0 );
ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("zMax", SceneManager::getInstance()->isAxialDisplayed() ? zMax : 0 );

}
else if( SceneManager::getInstance()->isFibersGeomShaderActive() && m_useSliceFibers )
{
// Determine X, Y and Z range
int curSliceX = SceneManager::getInstance()->getSliceX();
int curSliceY = SceneManager::getInstance()->getSliceY();
int curSliceZ = SceneManager::getInstance()->getSliceZ();

float xVoxSize = DatasetManager::getInstance()->getVoxelX();
float yVoxSize = DatasetManager::getInstance()->getVoxelY();
float zVoxSize = DatasetManager::getInstance()->getVoxelZ();

const float xMax( ( curSliceX + 0.5f ) * xVoxSize);
const float yMax( ( curSliceY + 0.5f ) * yVoxSize);
const float zMax( ( curSliceZ + 0.5f ) * zVoxSize);

ShaderHelper::getInstance()->getCrossingFibersShader()->bind();

ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("xMin", 0 );
ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("xMax", SceneManager::getInstance()->isSagittalDisplayed() ? xMax : 0 );

ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("yMin", 0 );
ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("yMax", SceneManager::getInstance()->isCoronalDisplayed() ? yMax : 0 );

ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("zMin", 0 );
ShaderHelper::getInstance()->getCrossingFibersShader()->setUniFloat("zMax", SceneManager::getInstance()->isAxialDisplayed() ? zMax : 0 );

}
else if ( !m_useTex )
{
Expand Down Expand Up @@ -4559,6 +4595,24 @@ void Fibers::updateAlpha()
m_pTxtclBox->SetValue(wxString::Format( wxT( "%.2f"), m_pSliderFiberscl->GetValue()/100.0f));
}

void Fibers::toggleCrossingFibers()
{
m_useIntersectedFibers = !m_useIntersectedFibers;
if(m_useIntersectedFibers)
m_pToggleSliceFibers->Enable(false);
else
m_pToggleSliceFibers->Enable(true);
}

void Fibers::toggleSliceFibers()
{
m_useSliceFibers = !m_useSliceFibers;
if(m_useSliceFibers)
m_pToggleCrossingFibers->Enable(false);
else
m_pToggleCrossingFibers->Enable(true);
}

void Fibers::setAxisView(bool value)
{
m_axisView = !value;
Expand Down
8 changes: 7 additions & 1 deletion src/dataset/Fibers.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ class Fibers : public DatasetInfo
void generateGeometry() {};
void smooth() {};

void toggleCrossingFibers() { m_useIntersectedFibers = !m_useIntersectedFibers; }
void toggleCrossingFibers();
void toggleSliceFibers();
bool isIntersectFibers() {return m_useIntersectedFibers;}
bool isSliceFibers() {return m_useSliceFibers;}

void updateCrossingFibersThickness();
void updateTubeRadius();

Expand Down Expand Up @@ -258,6 +262,7 @@ class Fibers : public DatasetInfo
bool m_coronalShown;
bool m_sagittalShown;
bool m_useIntersectedFibers;
bool m_useSliceFibers;
float m_thickness;
float m_tubeRadius;
float m_xDrawn;
Expand Down Expand Up @@ -294,6 +299,7 @@ class Fibers : public DatasetInfo
wxToggleButton *m_pToggleNormalColoring;
wxButton *m_pSelectConstantFibersColor;
wxToggleButton *m_pToggleCrossingFibers;
wxToggleButton *m_pToggleSliceFibers;
wxRadioButton *m_pRadNormalColoring;
wxRadioButton *m_pRadDistanceAnchoring;
wxRadioButton *m_pRadMinDistanceAnchoring;
Expand Down
4 changes: 2 additions & 2 deletions src/dataset/FibersGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ void FibersGroup::createPropertiesSizer( PropertiesWindow *pParent )
m_pLblSubsampling = new wxStaticText( pParent, wxID_ANY, wxT( "Subsampling" ) );
m_pLblThickness = new wxStaticText( pParent, wxID_ANY, wxT( "Thickness" ) );
m_pLblColoring = new wxStaticText( pParent, wxID_ANY, wxT( "Coloring" ) );
m_pSliderFibersFilterMin = new wxSlider( pParent, wxID_ANY, 0, 0, INT_MAX, DEF_POS, wxSize( 140, -1 ), wxSL_HORIZONTAL | wxSL_AUTOTICKS );
m_pSliderFibersFilterMax = new wxSlider( pParent, wxID_ANY, INT_MAX, 0, INT_MAX, DEF_POS, DEF_SIZE, wxSL_HORIZONTAL | wxSL_AUTOTICKS );
m_pSliderFibersFilterMin = new wxSlider( pParent, wxID_ANY, 0, 0, 300, DEF_POS, wxSize( 140, -1 ), wxSL_HORIZONTAL | wxSL_AUTOTICKS );
m_pSliderFibersFilterMax = new wxSlider( pParent, wxID_ANY, 300, 0, 300, DEF_POS, DEF_SIZE, wxSL_HORIZONTAL | wxSL_AUTOTICKS );

// We don't set the initial value of this slider to the START value because
// it is not used the same way when in the FibersGroup context.
Expand Down
9 changes: 5 additions & 4 deletions src/dataset/RTTFibers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,9 +1173,10 @@ void RTTFibers::performDTIRTT(Vector seed, int bwdfwd, vector<float>& points, ve
points.push_back( currPosition.x );
points.push_back( currPosition.y );
points.push_back( currPosition.z );
color.push_back( currDirection.x );
color.push_back( currDirection.y );
color.push_back( currDirection.z );
color.push_back( std::abs(currDirection.x) );
color.push_back( std::abs(currDirection.y) );
color.push_back( std::abs(currDirection.z) );
color.push_back( 1.0f );

//Advance
currPosition = nextPosition;
Expand Down Expand Up @@ -1505,7 +1506,7 @@ void RTTFibers::performHARDIRTT(Vector seed, int bwdfwd, vector<float>& points,
if( withinMapThreshold(sticksNumber, currPosition) && !m_stop && absPeak != 0)
{
bool initWithDir = RTTrackingHelper::getInstance()->isInitSeed();


if(bwdfwd != -1)
{
sticks = pickDirection(m_pMaximasInfo->getMainDirData()->at(sticksNumber), initWithDir, currPosition);
Expand Down
13 changes: 13 additions & 0 deletions src/gui/PropertiesWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2063,6 +2063,19 @@ void PropertiesWindow::OnToggleCrossingFibers( wxEvent& WXUNUSED(event) )
}
}

void PropertiesWindow::OnToggleSliceFibers( wxEvent& WXUNUSED(event) )
{
Logger::getInstance()->print( wxT( "Event triggered - PropertiesWindow::OnToggleCrossingFibers" ), LOGLEVEL_DEBUG );

if( m_pMainFrame->m_pCurrentSceneObject != NULL && m_pMainFrame->m_currentListIndex != -1 )
{
if( ((DatasetInfo*)m_pMainFrame->m_pCurrentSceneObject)->getType() == FIBERS )
{
((Fibers*)m_pMainFrame->m_pCurrentSceneObject)->toggleSliceFibers();
}
}
}

void PropertiesWindow::OnCrossingFibersThicknessChange( wxCommandEvent& WXUNUSED(event) )
{
Logger::getInstance()->print( wxT( "Event triggered - PropertiesWindow::OnCrossingFibersThicknessChange" ), LOGLEVEL_DEBUG );
Expand Down
2 changes: 2 additions & 0 deletions src/gui/PropertiesWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class PropertiesWindow : public wxScrolledWindow
void OnToggleMinMaxLengthBtn ( wxEvent& event );
void OnToggleSubsamplingBtn ( wxEvent& event );
void OnToggleCrossingFibersBtn ( wxEvent& event );
void OnToggleSliceFibersBtn ( wxEvent& event );
void OnToggleColorModeBtn ( wxEvent& event );
void OnToggleLocalColoringBtn ( wxEvent& event );
void OnToggleNormalColoringBtn ( wxEvent& event );
Expand Down Expand Up @@ -168,6 +169,7 @@ class PropertiesWindow : public wxScrolledWindow
void OnToggleFlipMagnetisation ( wxCommandEvent& event );

void OnToggleCrossingFibers ( wxEvent& event );
void OnToggleSliceFibers ( wxEvent& event );
void OnCrossingFibersThicknessChange ( wxCommandEvent& event );
void OnTubeRadius ( wxCommandEvent& event );

Expand Down

0 comments on commit 15df08d

Please sign in to comment.