From 2bbd98e7f1ccfdf4f7d47fbd28d036f95b85dfec Mon Sep 17 00:00:00 2001 From: Maxime C Date: Fri, 18 Sep 2015 10:31:54 -0400 Subject: [PATCH 1/6] fixed axis dirs flip for rtt, minis signed error --- src/dataset/Maximas.cpp | 3 +++ src/dataset/RTTrackingHelper.cpp | 1 + src/dataset/RTTrackingHelper.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dataset/Maximas.cpp b/src/dataset/Maximas.cpp index a61b372f..4041a212 100644 --- a/src/dataset/Maximas.cpp +++ b/src/dataset/Maximas.cpp @@ -6,6 +6,7 @@ #include "Maximas.h" #include "DatasetManager.h" +#include "RTTrackingHelper.h" #include "../Logger.h" #include "../gfx/ShaderHelper.h" #include "../gui/MyListCtrl.h" @@ -158,11 +159,13 @@ bool Maximas::load( nifti_image *pHeader, nifti_image *pBody ) if( m_originalAxialOrientation == 0 ) { flipAxis( X_AXIS, true ); + RTTrackingHelper::getInstance()->setMaximaFlip(Vector(-1,1,1)); flipAnat( X_AXIS ); } if( m_originalSagOrientation == 0 ) { flipAxis( Y_AXIS, true ); + RTTrackingHelper::getInstance()->setMaximaFlip(Vector(1,-1,1)); flipAnat( Y_AXIS ); } diff --git a/src/dataset/RTTrackingHelper.cpp b/src/dataset/RTTrackingHelper.cpp index a91f7169..dc45263a 100644 --- a/src/dataset/RTTrackingHelper.cpp +++ b/src/dataset/RTTrackingHelper.cpp @@ -22,6 +22,7 @@ RTTrackingHelper::RTTrackingHelper() m_id( 0 ), m_isSrcAlpha( true ), m_isRandomInit( true ), + flippedAxes( 1, 1, 1), m_bufferID( 0 ) { } diff --git a/src/dataset/RTTrackingHelper.h b/src/dataset/RTTrackingHelper.h index d3c4126c..156927b7 100644 --- a/src/dataset/RTTrackingHelper.h +++ b/src/dataset/RTTrackingHelper.h @@ -38,7 +38,7 @@ class RTTrackingHelper void setRTTDirty( bool dirty ) { m_isRTTDirty = dirty; } void setRTTActive( bool active ) { m_isRTTActive = active; } void setSeedFromfMRI( bool seedFromfMRI ) { m_isSeedFromfMRI = seedFromfMRI; } - void setMaximaFlip( Vector flip) { flippedAxes = flip; } + void setMaximaFlip( Vector flip) { flippedAxes.x = flip.x; flippedAxes.y = flip.y; flippedAxes.z = flip.z; } Vector getMaximaFlip() { return flippedAxes; } bool toggleInterpolateTensors() { return m_interpolateTensors = !m_interpolateTensors; } From 85630e5e6ac509400d597157bdf6029f1d09b83b Mon Sep 17 00:00:00 2001 From: Maxime C Date: Wed, 23 Sep 2015 13:19:50 -0400 Subject: [PATCH 2/6] now have include/excluse roi that can be turned on/off --- src/dataset/RTTFibers.cpp | 39 ++++-- src/dataset/RTTFibers.h | 5 + src/dataset/RTTrackingHelper.cpp | 2 + src/dataset/RTTrackingHelper.h | 8 ++ src/gui/PropertiesWindow.cpp | 4 +- src/gui/TrackingWindow.cpp | 197 +++++++++++++++++++++++-------- src/gui/TrackingWindow.h | 51 ++++---- 7 files changed, 217 insertions(+), 89 deletions(-) diff --git a/src/dataset/RTTFibers.cpp b/src/dataset/RTTFibers.cpp index 8f6bef9d..c307b4ce 100644 --- a/src/dataset/RTTFibers.cpp +++ b/src/dataset/RTTFibers.cpp @@ -35,7 +35,7 @@ RTTFibers::RTTFibers() m_FAThreshold( 0.20f ), m_angleThreshold( 35.0f ), m_step( 1.0f ), - m_GMstep( 15 ), + m_GMstep( 5 ), m_nbSeed ( 10.0f ), m_nbMeshPt ( 0 ), m_puncture( 0.2f ), @@ -47,11 +47,14 @@ RTTFibers::RTTFibers() m_isHARDI( false ), m_countGMstep( 0 ), m_stop( false ), + m_and( true ), m_pExcludeInfo( NULL ), + m_pIncludeInfo( NULL ), m_pSeedMapInfo( NULL ), m_pGMInfo( NULL ), m_render( true ), m_steppedOnceInsideChildBox( false ), + m_steppedOnceIntoAND( false ), m_prune(true) { m_bufferObjectsRTT = new GLuint[2]; @@ -219,7 +222,7 @@ void RTTFibers::seed() } //Track both sides performHARDIRTT( seed, 1, pointsF, colorF); //First pass - draw = m_render; + draw = m_render && m_and; performHARDIRTT( seed, -1, pointsB, colorB); //Second pass } else @@ -229,7 +232,7 @@ void RTTFibers::seed() performDTIRTT( Vector(x,y,z), -1, pointsB, colorB); //Second pass } - if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && !m_stop && (m_render || draw)) + if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && (m_render || draw )&& (draw || m_and)) { bool keepRight = false; bool keepLeft = false; @@ -273,6 +276,7 @@ void RTTFibers::seed() insertPointsForTractoDriven(pointsF, pointsB); } m_steppedOnceInsideChildBox = false; + m_steppedOnceIntoAND = false; } } } @@ -320,7 +324,7 @@ void RTTFibers::seed() } //Track both sides performHARDIRTT( seed, 1, pointsF, colorF); //First pass - draw = m_render; + draw = m_render && m_and; performHARDIRTT( seed, -1, pointsB, colorB); //Second pass } else @@ -330,7 +334,7 @@ void RTTFibers::seed() performDTIRTT( Vector(x,y,z), -1, pointsB, colorB); //Second pass } - if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && !m_stop && (m_render || draw)) + if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && (m_render || draw )&& (draw || m_and)) { bool keepRight = false; bool keepLeft = false; @@ -375,6 +379,7 @@ void RTTFibers::seed() insertPointsForTractoDriven(pointsF, pointsB); } m_steppedOnceInsideChildBox = false; + m_steppedOnceIntoAND = false; } } } @@ -421,7 +426,7 @@ void RTTFibers::seed() } //Track both sides performHARDIRTT( seed, 1, pointsF, colorF); //First pass - draw = m_render; + draw = m_render && m_and; performHARDIRTT( seed, -1, pointsB, colorB); //Second pass } else @@ -431,7 +436,7 @@ void RTTFibers::seed() performDTIRTT( Vector(x,y,z), -1, pointsB, colorB); //Second pass } - if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && !m_stop && (m_render || draw)) + if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && (m_render || draw ) && (draw || m_and)) { bool keepRight = false; bool keepLeft = false; @@ -476,6 +481,7 @@ void RTTFibers::seed() insertPointsForTractoDriven(pointsF, pointsB); } m_steppedOnceInsideChildBox = false; + m_steppedOnceIntoAND = false; } } } @@ -506,7 +512,7 @@ void RTTFibers::seed() { //Track both sides performHARDIRTT( Vector(positions[k].x,positions[k].y,positions[k].z), 1, pointsF, colorF); //First pass - draw = m_render; + draw = m_render && m_and; performHARDIRTT( Vector(positions[k].x,positions[k].y,positions[k].z), -1, pointsB, colorB); //Second pass } else @@ -516,7 +522,7 @@ void RTTFibers::seed() performDTIRTT( Vector(positions[k].x,positions[k].y,positions[k].z), -1, pointsB, colorB); //Second pass } - if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && !m_stop && (m_render || draw)) + if( (pointsF.size() + pointsB.size())/3 * getStep() > getMinFiberLength() && (pointsF.size() + pointsB.size())/3 * getStep() < getMaxFiberLength() && (m_render || draw) && (draw || m_and)) { bool keepRight = false; bool keepLeft = false; @@ -560,6 +566,7 @@ void RTTFibers::seed() insertPointsForTractoDriven(pointsF, pointsB); } m_steppedOnceInsideChildBox = false; + m_steppedOnceIntoAND = false; } } } @@ -1319,7 +1326,8 @@ std::vector RTTFibers::pickDirection(std::vector initialPeaks, boo bool RTTFibers::checkExclude( unsigned int sticksNumber) { bool res = true; - if(m_pExcludeInfo != NULL) + + if(m_pExcludeInfo != NULL && RTTrackingHelper::getInstance()->isNotMapOn()) { if(m_pExcludeInfo->at(sticksNumber) != 0) { @@ -1328,6 +1336,17 @@ bool RTTFibers::checkExclude( unsigned int sticksNumber) } } + if(m_pIncludeInfo != NULL && RTTrackingHelper::getInstance()->isAndMapOn()) + { + if(!m_steppedOnceIntoAND) + m_and = false; + if(m_pIncludeInfo->at(sticksNumber) != 0) + { + m_and = true; + m_steppedOnceIntoAND = true; + } + } + return res; } diff --git a/src/dataset/RTTFibers.h b/src/dataset/RTTFibers.h index f874b195..b2880a81 100644 --- a/src/dataset/RTTFibers.h +++ b/src/dataset/RTTFibers.h @@ -66,7 +66,9 @@ class RTTFibers void insertPointsForTractoDriven( std::vector pointsF, std::vector pointsB); void setExcludeInfo( Anatomy* info ) { m_pExcludeInfo = info; } + void setIncludeInfo( Anatomy* info ) { m_pIncludeInfo = info; } bool checkExclude(unsigned int sticksNumber); + void setAnd(bool val) { m_and = val;} float getFAThreshold() { return m_FAThreshold; } float getAngleThreshold() { return m_angleThreshold; } @@ -118,6 +120,7 @@ class RTTFibers DatasetInfo *m_pShellInfo; Anatomy *m_pMaskInfo; Anatomy *m_pExcludeInfo; + Anatomy *m_pIncludeInfo; Anatomy *m_pSeedMapInfo; Anatomy *m_pGMInfo; Vector m_initVec; @@ -129,8 +132,10 @@ class RTTFibers float m_alpha; int m_currentSeedBoxID; bool m_stop; + bool m_and; bool m_render; bool m_steppedOnceInsideChildBox; + bool m_steppedOnceIntoAND; bool m_prune; GLuint* m_bufferObjectsRTT; diff --git a/src/dataset/RTTrackingHelper.cpp b/src/dataset/RTTrackingHelper.cpp index dc45263a..ab13b4d1 100644 --- a/src/dataset/RTTrackingHelper.cpp +++ b/src/dataset/RTTrackingHelper.cpp @@ -19,6 +19,8 @@ RTTrackingHelper::RTTrackingHelper() m_isSeedFromfMRI ( false ), m_isTractoDrivenRSN( false ), m_isGMallowed( false ), + m_isNotMapOn( false ), + m_isAndMapOn( false ), m_id( 0 ), m_isSrcAlpha( true ), m_isRandomInit( true ), diff --git a/src/dataset/RTTrackingHelper.h b/src/dataset/RTTrackingHelper.h index 156927b7..595d4b2c 100644 --- a/src/dataset/RTTrackingHelper.h +++ b/src/dataset/RTTrackingHelper.h @@ -29,6 +29,8 @@ class RTTrackingHelper bool isSeedFromfMRI() const { return m_isSeedFromfMRI; } bool isTractoDrivenRSN() const { return m_isTractoDrivenRSN; } bool isGMAllowed() const { return m_isGMallowed; } + bool isNotMapOn() const {return m_isNotMapOn;} + bool isAndMapOn() const {return m_isAndMapOn;} bool isSrcAlpha() const { return m_isSrcAlpha; } bool isRandomInit() const { return m_isRandomInit; } @@ -50,6 +52,8 @@ class RTTrackingHelper bool toggleMagnet() { return m_isMagnetOn = !m_isMagnetOn; } bool toggleSrcAlpha() { return m_isSrcAlpha = !m_isSrcAlpha; } bool toggleRandomInit() { return m_isRandomInit = !m_isRandomInit; } + bool toggleNotMap() { return m_isNotMapOn = !m_isNotMapOn;} + bool toggleAndMap() { return m_isAndMapOn = !m_isAndMapOn;} bool togglePlayStop() { return m_isPaused = !m_isPaused; } bool isTrackActionPlaying() const { return m_isTrackActionPlaying; } @@ -59,6 +63,8 @@ class RTTrackingHelper void setShellSeed(bool enabled) {m_isShellSeeds = enabled;} void setSeedMap(bool enabled) {m_isSeedMap = enabled;} void setGMmap(bool enabled) {m_isGMallowed = enabled;} + void setNotmap(bool enabled) {m_isNotMapOn = enabled;} + void setAndmap(bool enabled) {m_isAndMapOn = enabled;} int generateId() {return (++m_id);} bool toogleTractoDrivenRSN() { return m_isTractoDrivenRSN = !m_isTractoDrivenRSN; } @@ -97,6 +103,8 @@ class RTTrackingHelper bool m_isSeedFromfMRI; bool m_isTractoDrivenRSN; bool m_isGMallowed; + bool m_isNotMapOn; + bool m_isAndMapOn; int m_id; bool m_isSrcAlpha; bool m_isRandomInit; diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index c083b753..a556b6fd 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -405,9 +405,7 @@ void PropertiesWindow::OnSliderIntensityThresholdMoved( wxCommandEvent& WXUNUSED std::vector< Vector > positions = s->m_tMesh->getVerts(); float shellSeedNb = positions.size(); - RTTrackingHelper::getInstance()->m_pTxtTotalSeedNbBox->SetValue(wxString::Format( wxT( "%.1f"), shellSeedNb) ); - - + RTTrackingHelper::getInstance()->m_pTxtTotalSeedNbBox->SetValue(wxString::Format( wxT( "%.1f"), shellSeedNb) ); } // This slider will set the Brightness level. Currently only the glyphs uses this value. diff --git a/src/gui/TrackingWindow.cpp b/src/gui/TrackingWindow.cpp index 886e7fc7..8979670e 100644 --- a/src/gui/TrackingWindow.cpp +++ b/src/gui/TrackingWindow.cpp @@ -63,43 +63,43 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id Connect( m_pSliderFA->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderFAMoved) ); m_pTxtFABox = new wxTextCtrl( this, wxID_ANY, wxT("0.20"), wxPoint(190,60), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextAngle = new wxStaticText( this, wxID_ANY, wxT("Max angle"), wxPoint(0,90), wxSize(60, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextAngle = new wxStaticText( this, wxID_ANY, wxT("Max angle"), wxPoint(0,90), wxSize(60, -1), wxALIGN_CENTER ); m_pSliderAngle = new MySlider( this, wxID_ANY, 0, 1, 90, wxPoint(60,90), wxSize(130, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderAngle->SetValue( 60 ); Connect( m_pSliderAngle->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderAngleMoved) ); m_pTxtAngleBox = new wxTextCtrl( this, wxID_ANY, wxT("60.0 "), wxPoint(190,90), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextStep = new wxStaticText( this, wxID_ANY, wxT("Step"), wxPoint(0,120), wxSize(60, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextStep = new wxStaticText( this, wxID_ANY, wxT("Step"), wxPoint(0,120), wxSize(60, -1), wxALIGN_CENTER ); m_pSliderStep = new MySlider( this, wxID_ANY, 0, 5, 20, wxPoint(60,120), wxSize(130, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderStep->SetValue( 10 ); Connect( m_pSliderStep->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderStepMoved) ); m_pTxtStepBox = new wxTextCtrl( this, wxID_ANY, wxT("1.0 mm"), wxPoint(190,120), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextPuncture = new wxStaticText( this, wxID_ANY, wxT("Vin-Vout"), wxPoint(0,150), wxSize(60, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextPuncture = new wxStaticText( this, wxID_ANY, wxT("Vin-Vout"), wxPoint(0,150), wxSize(60, -1), wxALIGN_CENTER ); m_pSliderPuncture = new MySlider( this, wxID_ANY, 0, 0, 10, wxPoint(60,150), wxSize(130, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderPuncture->SetValue( 2 ); Connect( m_pSliderPuncture->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderPunctureMoved) ); m_pTxtPunctureBox = new wxTextCtrl( this, wxID_ANY, wxT("0.2"), wxPoint(190,150), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextMinLength = new wxStaticText( this, wxID_ANY, wxT("Min length"), wxPoint(0,180), wxSize(60, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextMinLength = new wxStaticText( this, wxID_ANY, wxT("Min length"), wxPoint(0,180), wxSize(60, -1), wxALIGN_CENTER ); m_pSliderMinLength = new MySlider( this, wxID_ANY, 0, 0, 400, wxPoint(60,180), wxSize(130, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderMinLength->SetValue( 60 ); Connect( m_pSliderMinLength->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderMinLengthMoved) ); m_pTxtMinLengthBox = new wxTextCtrl( this, wxID_ANY, wxT("60 mm"), wxPoint(190,180), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextMaxLength = new wxStaticText( this, wxID_ANY, wxT("Max length"), wxPoint(0,210), wxSize(60, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextMaxLength = new wxStaticText( this, wxID_ANY, wxT("Max length"), wxPoint(0,210), wxSize(60, -1), wxALIGN_CENTER ); m_pSliderMaxLength = new MySlider( this, wxID_ANY, 0, 0, 300, wxPoint(60,210), wxSize(130, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderMaxLength->SetValue( 200 ); Connect( m_pSliderMaxLength->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderMaxLengthMoved) ); m_pTxtMaxLengthBox = new wxTextCtrl( this, wxID_ANY, wxT("200 mm"), wxPoint(190,210), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextAxisSeedNb = new wxStaticText( this, wxID_ANY, wxT("Seed/axis"), wxPoint(0,240), wxSize(60, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextAxisSeedNb = new wxStaticText( this, wxID_ANY, wxT("Seed/axis"), wxPoint(0,240), wxSize(60, -1), wxALIGN_CENTER ); RTTrackingHelper::getInstance()->m_pSliderAxisSeedNb = new MySlider( this, wxID_ANY, 0, 1, 15, wxPoint(60,240), wxSize(130, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); RTTrackingHelper::getInstance()->m_pSliderAxisSeedNb->SetValue( 10 ); Connect( RTTrackingHelper::getInstance()->m_pSliderAxisSeedNb->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderAxisSeedNbMoved) ); RTTrackingHelper::getInstance()->m_pTxtAxisSeedNbBox = new wxTextCtrl( this, wxID_ANY, wxT("10"), wxPoint(190,240), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); - m_pTextTotalSeedNb = new wxStaticText( this, wxID_ANY, wxT("Number of current seeds"), wxPoint(7,270), wxSize(150, -1), wxALIGN_LEFT ); + wxStaticText *m_pTextTotalSeedNb = new wxStaticText( this, wxID_ANY, wxT("Number of current seeds"), wxPoint(7,270), wxSize(150, -1), wxALIGN_LEFT ); RTTrackingHelper::getInstance()->m_pTxtTotalSeedNbBox = new wxTextCtrl( this, wxID_ANY, wxT("1000"), wxPoint(190,270), wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); m_pBtnConvert = new wxButton( this, wxID_ANY,wxT("Convert Fibers"), wxPoint(50,300), wxSize(140, 30) ); @@ -184,13 +184,31 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow2->Add( m_pToggleShell, 0, wxALIGN_CENTER | wxALL, 1); m_pTrackingSizer->Add( pBoxRow2, 0, wxFIXED_MINSIZE | wxALL, 2 ); - m_pBtnSelectExclusion = new wxButton( this, wxID_ANY,wxT("Exclusion map (CSF) not selected"), wxDefaultPosition, wxSize(230, -1) ); - Connect( m_pBtnSelectExclusion->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(TrackingWindow::OnSelectExclusion) ); + m_pBtnSelectNotMap = new wxButton( this, wxID_ANY,wxT("NOT not selected"), wxDefaultPosition, wxSize(115, -1) ); + Connect( m_pBtnSelectNotMap->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(TrackingWindow::OnSelectExclusion) ); + + m_pToggleNotMap = new wxToggleButton( this, wxID_ANY,wxT("NOT Map OFF"), wxDefaultPosition, wxSize(115, -1) ); + Connect( m_pToggleNotMap->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TrackingWindow::OnToggleNotMap) ); + m_pToggleGMmap->Enable(false); wxBoxSizer *pBoxRowEx = new wxBoxSizer( wxHORIZONTAL ); - pBoxRowEx->Add( m_pBtnSelectExclusion, 0, wxALIGN_CENTER | wxALL, 1 ); + pBoxRowEx->Add( m_pBtnSelectNotMap, 0, wxALIGN_CENTER | wxALL, 1 ); + pBoxRowEx->Add( m_pToggleNotMap, 0, wxALIGN_CENTER | wxALL, 1); m_pTrackingSizer->Add( pBoxRowEx, 0, wxFIXED_MINSIZE | wxALL, 2 ); + m_pBtnSelectAndMap = new wxButton( this, wxID_ANY,wxT("AND not selected"), wxDefaultPosition, wxSize(115, -1) ); + Connect( m_pBtnSelectAndMap->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(TrackingWindow::OnSelectInclusion) ); + + m_pToggleAndMap = new wxToggleButton( this, wxID_ANY,wxT("AND Map OFF"), wxDefaultPosition, wxSize(115, -1) ); + Connect( m_pToggleAndMap->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TrackingWindow::OnToggleAndMap) ); + m_pToggleAndMap->Enable(false); + + wxBoxSizer *pBoxRowInc = new wxBoxSizer( wxHORIZONTAL ); + pBoxRowInc->Add( m_pBtnSelectAndMap, 0, wxALIGN_CENTER | wxALL, 1 ); + pBoxRowInc->Add( m_pToggleAndMap, 0, wxALIGN_CENTER | wxALL, 1); + m_pTrackingSizer->Add( pBoxRowInc, 0, wxFIXED_MINSIZE | wxALL, 2 ); + + m_pToggleRandomInit = new wxToggleButton( this, wxID_ANY,wxT("Randomly spaced seeds"), wxDefaultPosition, wxSize(230, -1) ); Connect( m_pToggleRandomInit->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TrackingWindow::OnRandomSeeding) ); @@ -227,7 +245,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow5->Add( m_pTxtFABox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow5, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextAngle = new wxStaticText( this, wxID_ANY, wxT("Max angle"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextAngle = new wxStaticText( this, wxID_ANY, wxT("Max angle"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderAngle = new MySlider( this, wxID_ANY, 0, 1, 90, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderAngle->SetValue( 35 ); Connect( m_pSliderAngle->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderAngleMoved) ); @@ -239,7 +257,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow6->Add( m_pTxtAngleBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow6, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextStep = new wxStaticText( this, wxID_ANY, wxT("Step"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextStep = new wxStaticText( this, wxID_ANY, wxT("Step"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderStep = new MySlider( this, wxID_ANY, 0, 1, 20, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderStep->SetValue( 10 ); Connect( m_pSliderStep->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderStepMoved) ); @@ -251,7 +269,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow7->Add( m_pTxtStepBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow7, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextPuncture = new wxStaticText( this, wxID_ANY, wxT("g (weight)"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextPuncture = new wxStaticText( this, wxID_ANY, wxT("g (weight)"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderPuncture = new MySlider( this, wxID_ANY, 0, 40, 100, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderPuncture->SetValue( 60 ); Connect( m_pSliderPuncture->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderPunctureMoved) ); @@ -263,11 +281,11 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow8->Add( m_pTxtPunctureBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow8, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextGMStep = new wxStaticText( this, wxID_ANY, wxT("GM steps"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextGMStep = new wxStaticText( this, wxID_ANY, wxT("GM steps"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderGMStep = new MySlider( this, wxID_ANY, 0, 0, 300, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); - m_pSliderGMStep->SetValue( 15 ); + m_pSliderGMStep->SetValue( 5 ); Connect( m_pSliderGMStep->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderGMStepMoved) ); - m_pTxtGMStepBox = new wxTextCtrl( this, wxID_ANY, wxT("15"), wxDefaultPosition, wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); + m_pTxtGMStepBox = new wxTextCtrl( this, wxID_ANY, wxT("5"), wxDefaultPosition, wxSize(55, -1), wxTE_CENTRE | wxTE_READONLY ); wxBoxSizer *pBoxRowGMstep = new wxBoxSizer( wxHORIZONTAL ); pBoxRowGMstep->Add( m_pTextGMStep, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 1 ); @@ -275,7 +293,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRowGMstep->Add( m_pTxtGMStepBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRowGMstep, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextMinLength = new wxStaticText( this, wxID_ANY, wxT("Min length"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextMinLength = new wxStaticText( this, wxID_ANY, wxT("Min length"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderMinLength = new MySlider( this, wxID_ANY, 0, 0, 400, wxPoint(60,240), wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderMinLength->SetValue( 60 ); Connect( m_pSliderMinLength->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderMinLengthMoved) ); @@ -287,7 +305,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow9->Add( m_pTxtMinLengthBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow9, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextMaxLength = new wxStaticText( this, wxID_ANY, wxT("Max length"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextMaxLength = new wxStaticText( this, wxID_ANY, wxT("Max length"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderMaxLength = new MySlider( this, wxID_ANY, 0, 0, 300, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderMaxLength->SetValue( 200 ); Connect( m_pSliderMaxLength->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderMaxLengthMoved) ); @@ -299,7 +317,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow10->Add( m_pTxtMaxLengthBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow10, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextAxisSeedNb = new wxStaticText( this, wxID_ANY, wxT("Seeds (^3)"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextAxisSeedNb = new wxStaticText( this, wxID_ANY, wxT("Seeds (^3)"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); RTTrackingHelper::getInstance()->m_pSliderAxisSeedNb = new MySlider( this, wxID_ANY, 0, 1, 15, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); RTTrackingHelper::getInstance()->m_pSliderAxisSeedNb->SetValue( 10 ); Connect( RTTrackingHelper::getInstance()->m_pSliderAxisSeedNb->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderAxisSeedNbMoved) ); @@ -311,7 +329,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow11->Add( RTTrackingHelper::getInstance()->m_pTxtAxisSeedNbBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow11, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextTotalSeedNb = new wxStaticText( this, wxID_ANY, wxT("Number of current seeds"), wxDefaultPosition, wxSize(170, -1), wxALIGN_LEFT ); + wxStaticText *m_pTextTotalSeedNb = new wxStaticText( this, wxID_ANY, wxT("Number of current seeds"), wxDefaultPosition, wxSize(170, -1), wxALIGN_LEFT ); RTTrackingHelper::getInstance()->m_pTxtTotalSeedNbBox = new wxTextCtrl( this, wxID_ANY, wxT("1000"), wxDefaultPosition, wxSize(60, -1), wxTE_CENTRE | wxTE_READONLY ); wxBoxSizer *pBoxRow12 = new wxBoxSizer( wxHORIZONTAL ); @@ -319,7 +337,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxRow12->Add( RTTrackingHelper::getInstance()->m_pTxtTotalSeedNbBox, 0, wxALIGN_LEFT | wxALL, 1); m_pTrackingSizer->Add( pBoxRow12, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTextOpacity = new wxStaticText( this, wxID_ANY, wxT("Opacity"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); + wxStaticText *m_pTextOpacity = new wxStaticText( this, wxID_ANY, wxT("Opacity"), wxDefaultPosition, wxSize(70, -1), wxALIGN_CENTER ); m_pSliderOpacity = new MySlider( this, wxID_ANY, 0, 0, 100, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS ); m_pSliderOpacity->SetValue( 100 ); Connect( m_pSliderOpacity->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TrackingWindow::OnSliderOpacityMoved) ); @@ -379,7 +397,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id /*-----------------------MAGNET SECTION-----------------------------------*/ - /*wxTextCtrl *magnetZone = new wxTextCtrl( this, wxID_ANY, wxT("Magnet tracking"), wxDefaultPosition, wxSize(115, -1), wxTE_CENTER | wxTE_READONLY ); + wxTextCtrl *magnetZone = new wxTextCtrl( this, wxID_ANY, wxT("Magnet tracking"), wxDefaultPosition, wxSize(115, -1), wxTE_CENTER | wxTE_READONLY ); magnetZone->SetBackgroundColour( *wxLIGHT_GREY ); wxFont magnet_font = magnetZone->GetFont(); magnet_font.SetPointSize( 10 ); @@ -392,13 +410,13 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id m_pTrackingSizer->Add( pBoxMagnetZone, 0, wxFIXED_MINSIZE | wxALL, 2 ); wxImage bmpMagnetR( MyApp::iconsPath + wxT( "magnet_r.png" ), wxBITMAP_TYPE_PNG ); - m_pBtnPlaceMagnetR = new wxBitmapButton( this, wxID_ANY, bmpMagnetR, wxDefaultPosition, wxSize( 30, -1 ) ); + wxBitmapButton *m_pBtnPlaceMagnetR = new wxBitmapButton( this, wxID_ANY, bmpMagnetR, wxDefaultPosition, wxSize( 30, -1 ) ); Connect( m_pBtnPlaceMagnetR->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackingWindow::OnPlaceMagnetR ) ); wxImage bmpMagnetG( MyApp::iconsPath + wxT( "magnet_g.png" ), wxBITMAP_TYPE_PNG ); - m_pBtnPlaceMagnetG = new wxBitmapButton( this, wxID_ANY, bmpMagnetG, wxDefaultPosition, wxSize( 30, -1 ) ); + wxBitmapButton *m_pBtnPlaceMagnetG = new wxBitmapButton( this, wxID_ANY, bmpMagnetG, wxDefaultPosition, wxSize( 30, -1 ) ); Connect( m_pBtnPlaceMagnetG->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackingWindow::OnPlaceMagnetG ) ); wxImage bmpMagnetB( MyApp::iconsPath + wxT( "magnet_b.png" ), wxBITMAP_TYPE_PNG ); - m_pBtnPlaceMagnetB = new wxBitmapButton( this, wxID_ANY, bmpMagnetB, wxDefaultPosition, wxSize( 30, -1 ) ); + wxBitmapButton *m_pBtnPlaceMagnetB = new wxBitmapButton( this, wxID_ANY, bmpMagnetB, wxDefaultPosition, wxSize( 30, -1 ) ); Connect( m_pBtnPlaceMagnetB->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackingWindow::OnPlaceMagnetB ) ); m_pToggleMagnetMode = new wxToggleButton( this, wxID_ANY,wxT("Start magnet"), wxDefaultPosition, wxSize(115, -1) ); @@ -410,7 +428,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxMagnet1->Add( m_pBtnPlaceMagnetB, 1, wxEXPAND | wxALL, 1 ); m_pTrackingSizer->Add( pBoxMagnet1, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTrackingSizer->Add( m_pToggleMagnetMode, 1, wxEXPAND | wxALL, 1 );*/ + m_pTrackingSizer->Add( m_pToggleMagnetMode, 1, wxEXPAND | wxALL, 1 ); } @@ -797,9 +815,86 @@ void TrackingWindow::OnSelectExclusion( wxCommandEvent& WXUNUSED(event) ) if( pMap != NULL && pMap->getBands() == 1 ) { - m_pBtnSelectExclusion->SetLabel( wxT("Exclusion:") + pMap->getName() ); + m_pBtnSelectNotMap->SetLabel( pMap->getName() ); SceneManager::getInstance()->getScene()->getRTTfibers()->setExcludeInfo( (Anatomy *)DatasetManager::getInstance()->getDataset( m_pMainFrame->m_pListCtrl->GetItem( item ) ) ); + + m_pToggleNotMap->Enable(true); + m_pToggleNotMap->SetValue(true); + + RTTrackingHelper::getInstance()->setNotmap(true); + RTTrackingHelper::getInstance()->setRTTDirty( true ); + } + + if( !RTTrackingHelper::getInstance()->isNotMapOn() ) + { + m_pToggleNotMap->SetLabel(wxT( "NOT map OFF")); + } + else + { + m_pToggleNotMap->SetLabel(wxT( "NOT map ON")); + } +} + +void TrackingWindow::OnToggleNotMap( wxCommandEvent& WXUNUSED(event) ) +{ + RTTrackingHelper::getInstance()->toggleNotMap(); + RTTrackingHelper::getInstance()->setRTTDirty( true ); + + if( !RTTrackingHelper::getInstance()->isNotMapOn() ) + { + m_pToggleNotMap->SetLabel(wxT( "NOT map OFF")); + } + else + { + m_pToggleNotMap->SetLabel(wxT( "NOT map ON")); + } +} + +void TrackingWindow::OnSelectInclusion( wxCommandEvent& WXUNUSED(event) ) +{ + //Select map for threshold seeding + long item = m_pMainFrame->getCurrentListIndex(); + Anatomy* pMap = (Anatomy*)DatasetManager::getInstance()->getDataset (MyApp::frame->m_pListCtrl->GetItem( item )); + + if( pMap != NULL && pMap->getBands() == 1 ) + { + m_pBtnSelectAndMap->SetLabel( pMap->getName() ); + SceneManager::getInstance()->getScene()->getRTTfibers()->setIncludeInfo( (Anatomy *)DatasetManager::getInstance()->getDataset( m_pMainFrame->m_pListCtrl->GetItem( item ) ) ); + + m_pToggleAndMap->Enable(true); + m_pToggleAndMap->SetValue(true); + + RTTrackingHelper::getInstance()->setAndmap(true); + RTTrackingHelper::getInstance()->setRTTDirty( true ); } + + if( !RTTrackingHelper::getInstance()->isAndMapOn() ) + { + m_pToggleAndMap->SetLabel(wxT( "AND map OFF")); + SceneManager::getInstance()->getScene()->getRTTfibers()->setAnd(true); + } + else + { + m_pToggleAndMap->SetLabel(wxT( "AND map ON")); + SceneManager::getInstance()->getScene()->getRTTfibers()->setAnd(false); + } +} + +void TrackingWindow::OnToggleAndMap( wxCommandEvent& WXUNUSED(event) ) +{ + RTTrackingHelper::getInstance()->toggleAndMap(); + RTTrackingHelper::getInstance()->setRTTDirty( true ); + + if( !RTTrackingHelper::getInstance()->isAndMapOn() ) + { + m_pToggleAndMap->SetLabel(wxT( "AND map OFF")); + SceneManager::getInstance()->getScene()->getRTTfibers()->setAnd(true); + } + else + { + m_pToggleAndMap->SetLabel(wxT( "AND map ON")); + SceneManager::getInstance()->getScene()->getRTTfibers()->setAnd(false); + } } void TrackingWindow::OnShellSeeding( wxCommandEvent& WXUNUSED(event) ) @@ -900,30 +995,30 @@ void TrackingWindow::OnConvertToFibers( wxCommandEvent& WXUNUSED(event) ) } } -void TrackingWindow::OnPlay( wxCommandEvent& WXUNUSED(event) ) -{ - RTTrackingHelper::getInstance()->setTrackAction(true); - RTTrackingHelper::getInstance()->togglePlayStop(); - if(!RTTrackingHelper::getInstance()->isTrackActionPaused()) - { - m_pPlayPause->SetBitmapLabel(m_bmpPause); - m_pMainFrame->setTimerSpeed(); - } - else - { - m_pPlayPause->SetBitmapLabel(m_bmpPlay); - m_pMainFrame->setTimerSpeed(); - } -} - -void TrackingWindow::OnStop( wxCommandEvent& WXUNUSED(event) ) -{ - SceneManager::getInstance()->getScene()->getRTTfibers()->m_trackActionStep = 0; - RTTrackingHelper::getInstance()->setTrackAction(false); - RTTrackingHelper::getInstance()->setTrackActionPause(true); - m_pPlayPause->SetBitmapLabel(m_bmpPlay); - m_pMainFrame->setTimerSpeed(); -} +//void TrackingWindow::OnPlay( wxCommandEvent& WXUNUSED(event) ) +//{ +// RTTrackingHelper::getInstance()->setTrackAction(true); +// RTTrackingHelper::getInstance()->togglePlayStop(); +// if(!RTTrackingHelper::getInstance()->isTrackActionPaused()) +// { +// m_pPlayPause->SetBitmapLabel(m_bmpPause); +// m_pMainFrame->setTimerSpeed(); +// } +// else +// { +// m_pPlayPause->SetBitmapLabel(m_bmpPlay); +// m_pMainFrame->setTimerSpeed(); +// } +//} +// +//void TrackingWindow::OnStop( wxCommandEvent& WXUNUSED(event) ) +//{ +// SceneManager::getInstance()->getScene()->getRTTfibers()->m_trackActionStep = 0; +// RTTrackingHelper::getInstance()->setTrackAction(false); +// RTTrackingHelper::getInstance()->setTrackActionPause(true); +// m_pPlayPause->SetBitmapLabel(m_bmpPlay); +// m_pMainFrame->setTimerSpeed(); +//} void TrackingWindow::OnSrcAlpha( wxCommandEvent& event ) { diff --git a/src/gui/TrackingWindow.h b/src/gui/TrackingWindow.h index 705e9da3..e12b78dd 100644 --- a/src/gui/TrackingWindow.h +++ b/src/gui/TrackingWindow.h @@ -33,8 +33,6 @@ class TrackingWindow: public wxScrolledWindow void OnSize( wxSizeEvent &event ); wxSizer* getWindowSizer(); - - void OnStartTracking ( wxCommandEvent& event ); void OnSelectShell ( wxCommandEvent& event ); void OnClearBox ( wxTreeEvent& event ); @@ -52,7 +50,10 @@ class TrackingWindow: public wxScrolledWindow void OnInitY ( wxCommandEvent& event ); void OnInitZ ( wxCommandEvent& event ); void OnSelectExclusion ( wxCommandEvent& event ); - + void OnToggleNotMap ( wxCommandEvent& event ); + void OnSelectInclusion ( wxCommandEvent& event ); + void OnToggleAndMap ( wxCommandEvent& event ); + void OnInterpolate ( wxCommandEvent& event ); void OnSliderPunctureMoved ( wxCommandEvent& event ); void OnSliderMinLengthMoved ( wxCommandEvent& event ); @@ -76,8 +77,6 @@ class TrackingWindow: public wxScrolledWindow public: wxToggleButton *m_pBtnStart; - - private: MainFrame *m_pMainFrame; @@ -85,16 +84,16 @@ class TrackingWindow: public wxScrolledWindow wxTextCtrl *m_pTxtFABox; wxStaticText *m_pTextFA; wxSlider *m_pSliderAngle; - wxStaticText *m_pTextAngle; + //wxStaticText *m_pTextAngle; wxTextCtrl *m_pTxtAngleBox; wxSlider *m_pSliderStep; - wxStaticText *m_pTextStep; + //wxStaticText *m_pTextStep; wxTextCtrl *m_pTxtStepBox; wxSlider *m_pSliderPuncture; - wxStaticText *m_pTextPuncture; + //wxStaticText *m_pTextPuncture; wxTextCtrl *m_pTxtPunctureBox; wxSlider *m_pSliderGMStep; - wxStaticText *m_pTextGMStep; + //wxStaticText *m_pTextGMStep; wxTextCtrl *m_pTxtGMStepBox; wxButton *m_pBtnSelectFile; wxButton *m_pBtnSelectShell; @@ -107,35 +106,37 @@ class TrackingWindow: public wxScrolledWindow wxToggleButton *m_pToggleTrackX; wxToggleButton *m_pToggleTrackY; wxToggleButton *m_pToggleTrackZ; - wxButton *m_pBtnSelectExclusion; - wxStaticText *m_pTextMinLength; + wxButton *m_pBtnSelectNotMap; + wxToggleButton *m_pToggleNotMap; + wxButton *m_pBtnSelectAndMap; + wxToggleButton *m_pToggleAndMap; + //wxStaticText *m_pTextMinLength; wxSlider *m_pSliderMinLength; wxTextCtrl *m_pTxtMinLengthBox; - wxStaticText *m_pTextOpacity; + //wxStaticText *m_pTextOpacity; wxSlider *m_pSliderOpacity; wxTextCtrl *m_pTxtOpacityBox; wxToggleButton *m_pBtnToggleSrcAlpha; wxSlider *m_pSliderMaxLength; - wxStaticText *m_pTextMaxLength; + //wxStaticText *m_pTextMaxLength; wxTextCtrl *m_pTxtMaxLengthBox; wxButton *m_pBtnConvert; wxToggleButton *m_pToggleRandomInit; - - - wxStaticText *m_pTextAxisSeedNb; - wxStaticText *m_pTextTotalSeedNb; - wxStaticLine *m_pLineSeparator; - wxBitmapButton *m_pPlayPause; - wxBitmapButton *m_pBtnStop; - wxImage m_bmpPause; - wxImage m_bmpPlay; - wxBitmapButton *m_pBtnPlaceMagnetR; - wxBitmapButton *m_pBtnPlaceMagnetG; - wxBitmapButton *m_pBtnPlaceMagnetB; + //wxStaticText *m_pTextAxisSeedNb; + //wxStaticText *m_pTextTotalSeedNb; + //wxStaticLine *m_pLineSeparator; + //wxBitmapButton *m_pPlayPause; + //wxBitmapButton *m_pBtnStop; + //wxImage m_bmpPause; + //wxImage m_bmpPlay; + //wxBitmapButton *m_pBtnPlaceMagnetR; + //wxBitmapButton *m_pBtnPlaceMagnetG; + //wxBitmapButton *m_pBtnPlaceMagnetB; wxToggleButton *m_pToggleMagnetMode; private: + wxSizer *m_pTrackingSizer; TrackingWindow( wxWindow *pParent, wxWindowID id, const wxPoint &pos, const wxSize &size ); DECLARE_DYNAMIC_CLASS( TrackingWindow ) From 8e8762332c43d59543a426300537479f1b5ca6f9 Mon Sep 17 00:00:00 2001 From: Maxime C Date: Thu, 24 Sep 2015 12:49:26 -0400 Subject: [PATCH 3/6] changed pro. eq. to simon's idea. simple in and out arg max --- src/dataset/RTTFibers.cpp | 13 +++++++------ src/dataset/RTTFibers.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/dataset/RTTFibers.cpp b/src/dataset/RTTFibers.cpp index c307b4ce..6689a79f 100644 --- a/src/dataset/RTTFibers.cpp +++ b/src/dataset/RTTFibers.cpp @@ -804,7 +804,7 @@ Vector RTTFibers::advecIntegrateHARDI( Vector vin, const std::vector &sti Vector vMagnet(0,0,0); float angleMin = 360.0f; float angle = 0.0f; - float puncture = m_vinvout; + float g = m_vinvout; float wm = m_pMaskInfo->at(s_number); float gm = 0; float F = 0; @@ -820,7 +820,7 @@ Vector RTTFibers::advecIntegrateHARDI( Vector vin, const std::vector &sti bool isMagnetOn = RTTrackingHelper::getInstance()->isMagnetOn(); if(isMagnetOn) { - vMagnet = magneticField(vin, sticks, s_number, pos, vOut, F); + vMagnet = magneticField(vin, sticks, s_number, pos, vOut, F, g); } else { @@ -860,12 +860,12 @@ Vector RTTFibers::advecIntegrateHARDI( Vector vin, const std::vector &sti //} //Weight between in and out directions. Magnet will also be weighted by distance. - Vector res = (1-F)*((1.0 - puncture ) * vin + puncture * vOut) + F * vMagnet; + Vector res = (1-F)*((1.0 - g) * vin + g * vOut) + F * vMagnet; return res; } -Vector RTTFibers::magneticField(Vector vin, const std::vector &sticks, float s_number, Vector pos, Vector& vOut, float& F) +Vector RTTFibers::magneticField(Vector vin, const std::vector &sticks, float s_number, Vector pos, Vector& vOut, float& F, float& G) { Vector final = vin; bool alreadyAffected = false; @@ -921,11 +921,12 @@ Vector RTTFibers::magneticField(Vector vin, const std::vector &sticks, fl if( angle < angleMin ) { angleMin = angle; - final = v1; + vOut = v1; } } } - F = selObjs[b]->getStrength(); + //F = selObjs[b]->getStrength(); + //G = 0; alreadyAffected = true; } else diff --git a/src/dataset/RTTFibers.h b/src/dataset/RTTFibers.h index b2880a81..62712ee2 100644 --- a/src/dataset/RTTFibers.h +++ b/src/dataset/RTTFibers.h @@ -35,7 +35,7 @@ class RTTFibers FMatrix trilinearInterp( float fx, float fy, float fz ); Vector advecIntegrate( Vector vin, const FMatrix &tensor, Vector e1, Vector e2, Vector e3, float tensorNumber ); Vector advecIntegrateHARDI( Vector vin, const std::vector &sticks, float peaksNumber, Vector pos ); - Vector magneticField( Vector vin, const std::vector &sticks, float peaksNumber, Vector pos, Vector& vOut, float& F); + Vector magneticField( Vector vin, const std::vector &sticks, float peaksNumber, Vector pos, Vector& vOut, float& F, float& G); void clearFibersRTT(); From 8a4e1e83ca79d447c56a12ce3d5b5c0e6e0869f0 Mon Sep 17 00:00:00 2001 From: Maxime C Date: Mon, 28 Sep 2015 15:31:23 -0400 Subject: [PATCH 4/6] fixed peak initialization when using n>3. --- src/dataset/RTTFibers.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dataset/RTTFibers.cpp b/src/dataset/RTTFibers.cpp index 6689a79f..38bcc08f 100644 --- a/src/dataset/RTTFibers.cpp +++ b/src/dataset/RTTFibers.cpp @@ -1242,14 +1242,14 @@ std::vector RTTFibers::pickDirection(std::vector initialPeaks, boo std::vector draftedPeak; if(!initWithDir) { - - float norms[3]; + unsigned int nbPeaks = initialPeaks.size()/3; + std::vector norms; float sum = 0.0f; - for(unsigned int i=0; i < initialPeaks.size()/3; i++) + for(unsigned int i=0; i < nbPeaks; i++) { Vector v1(initialPeaks[i*3],initialPeaks[i*3+1], initialPeaks[i*3+2]); - norms[i] = v1.getLength(); + norms.push_back(v1.getLength()); sum += norms[i]; } From 6248d0a7db2328afe187391bb8f6b428d5916ab1 Mon Sep 17 00:00:00 2001 From: Maxime C Date: Fri, 2 Oct 2015 14:49:22 -0400 Subject: [PATCH 5/6] Fixed load saving of scenes including magnet rois --- src/dataset/Maximas.cpp | 10 ++++++++++ src/dataset/Maximas.h | 1 + src/gui/PropertiesWindow.cpp | 1 + src/gui/SceneManager.cpp | 2 +- src/gui/SelectionObject.cpp | 27 ++++++++++++++++++++++----- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/dataset/Maximas.cpp b/src/dataset/Maximas.cpp index 4041a212..45ee5973 100644 --- a/src/dataset/Maximas.cpp +++ b/src/dataset/Maximas.cpp @@ -537,3 +537,13 @@ void Maximas::updatePropertiesSizer() m_pRadMapOnSphere->Hide(); m_pRadMainAxis->Hide(); } + +bool Maximas::save( wxXmlNode *pNode, const wxString &rootPath ) const +{ + assert( pNode != NULL ); + + pNode->SetName( wxT( "dataset" ) ); + DatasetInfo::save( pNode, rootPath ); + + return true; +} \ No newline at end of file diff --git a/src/dataset/Maximas.h b/src/dataset/Maximas.h index b89ee9da..1195d9cf 100644 --- a/src/dataset/Maximas.h +++ b/src/dataset/Maximas.h @@ -18,6 +18,7 @@ class Maximas : public Glyph //Maximas(); Maximas( const wxString &filename ); virtual ~Maximas(); + bool save( wxXmlNode *pNode, const wxString &rootPath ) const; std::vector< std::vector > *getMainDirData() { return &m_mainDirections; }; diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index a556b6fd..4a1548f5 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -499,6 +499,7 @@ void PropertiesWindow::OnFitToAnat( wxCommandEvent& WXUNUSED(event) ) if( pFibers != NULL ) { pFibers->fitToAnat(false); + pFibers->updateLinesShown(); } } else diff --git a/src/gui/SceneManager.cpp b/src/gui/SceneManager.cpp index e48c52c3..fb31c7e4 100644 --- a/src/gui/SceneManager.cpp +++ b/src/gui/SceneManager.cpp @@ -602,7 +602,7 @@ bool SceneManager::loadOldVersion( wxXmlNode * pRoot, const wxString &rootPath } else { - wxFileName fullDatasetPath( rootPath + wxFileName::GetPathSeparator() + path ); + wxFileName fullDatasetPath( path ); index = DatasetManager::getInstance()->load( fullDatasetPath.GetFullPath(), extension ); } diff --git a/src/gui/SelectionObject.cpp b/src/gui/SelectionObject.cpp index 6614e95c..f70f84e3 100644 --- a/src/gui/SelectionObject.cpp +++ b/src/gui/SelectionObject.cpp @@ -119,6 +119,19 @@ SelectionObject::SelectionObject( const wxXmlNode selObjNode ) m_isVisible = parseXmlBoolString( propVal ); pChildNode->GetAttribute( wxT("isNOT"), &propVal ); m_isNOT = parseXmlBoolString( propVal ); + pChildNode->GetAttribute( wxT("isMagnet"), &propVal ); + m_isMagnet = parseXmlBoolString( propVal ); + + double x, y, z; + pChildNode->GetAttribute( wxT("fieldX"), &propVal ); + propVal.ToDouble( &x ); + m_magnetField.x = x; + pChildNode->GetAttribute( wxT("fieldY"), &propVal ); + propVal.ToDouble( &y ); + m_magnetField.y = y; + pChildNode->GetAttribute( wxT("fieldZ"), &propVal ); + propVal.ToDouble( &z ); + m_magnetField.z = z; } else if( nodeName == wxT("center") ) { @@ -1937,6 +1950,10 @@ bool SelectionObject::populateXMLNode( wxXmlNode *pCurNode, const wxString &root pState->AddAttribute( new wxXmlAttribute( wxT( "active" ), m_isActive? wxT( "yes" ) : wxT( "no" ) ) ); pState->AddAttribute( new wxXmlAttribute( wxT( "visible" ), m_isVisible? wxT( "yes" ) : wxT( "no" ) ) ); pState->AddAttribute( new wxXmlAttribute( wxT( "isNOT" ), m_isNOT? wxT( "yes" ) : wxT( "no" ) ) ); + pState->AddAttribute( new wxXmlAttribute( wxT( "isMagnet" ), m_isMagnet? wxT( "yes" ) : wxT( "no" ) ) ); + pState->AddAttribute( new wxXmlAttribute( wxT( "fieldX" ), wxStrFormat( m_magnetField.x, floatPrecision ) ) ); + pState->AddAttribute( new wxXmlAttribute( wxT( "fieldY" ), wxStrFormat( m_magnetField.y, floatPrecision ) ) ); + pState->AddAttribute( new wxXmlAttribute( wxT( "fieldZ" ), wxStrFormat( m_magnetField.z, floatPrecision ) ) ); wxXmlNode *pCenter = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT( "center" ) ); @@ -1961,11 +1978,11 @@ bool SelectionObject::populateXMLNode( wxXmlNode *pCurNode, const wxString &root pDistanceColoring->AddAttribute( new wxXmlAttribute( wxT( "used" ), m_DistColoring ? wxT( "yes") : wxT( "no" ) ) ); pCurNode->AddChild( pDistanceColoring ); - wxXmlNode *pMeanFiberOptions = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT( "mean_fiber_options" ) ); - pMeanFiberOptions->AddAttribute( new wxXmlAttribute( wxT( "colorHTML" ), m_meanFiberColor.GetAsString(wxC2S_HTML_SYNTAX) ) ); - pMeanFiberOptions->AddAttribute( new wxXmlAttribute( wxT( "opacity" ), wxStrFormat( m_meanFiberOpacity, floatPrecision ) ) ); - pMeanFiberOptions->AddAttribute( new wxXmlAttribute( wxT( "colorationMode" ), Helper::getColorationModeString( m_meanFiberColorationMode ) ) ); - pCurNode->AddChild( pMeanFiberOptions ); + //wxXmlNode *pMeanFiberOptions = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT( "mean_fiber_options" ) ); + //pMeanFiberOptions->AddAttribute( new wxXmlAttribute( wxT( "colorHTML" ), m_meanFiberColor.GetAsString(wxC2S_HTML_SYNTAX) ) ); + //pMeanFiberOptions->AddAttribute( new wxXmlAttribute( wxT( "opacity" ), wxStrFormat( m_meanFiberOpacity, floatPrecision ) ) ); + //pMeanFiberOptions->AddAttribute( new wxXmlAttribute( wxT( "colorationMode" ), Helper::getColorationModeString( m_meanFiberColorationMode ) ) ); + //pCurNode->AddChild( pMeanFiberOptions ); return true; } From edb3cd2d81ef28a5196c064fc76f7e918ce98d7b Mon Sep 17 00:00:00 2001 From: Maxime C Date: Thu, 8 Oct 2015 10:40:31 -0400 Subject: [PATCH 6/6] merge oct --- src/gui/TrackingWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/TrackingWindow.cpp b/src/gui/TrackingWindow.cpp index 8979670e..7926878b 100644 --- a/src/gui/TrackingWindow.cpp +++ b/src/gui/TrackingWindow.cpp @@ -397,7 +397,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id /*-----------------------MAGNET SECTION-----------------------------------*/ - wxTextCtrl *magnetZone = new wxTextCtrl( this, wxID_ANY, wxT("Magnet tracking"), wxDefaultPosition, wxSize(115, -1), wxTE_CENTER | wxTE_READONLY ); + /*wxTextCtrl *magnetZone = new wxTextCtrl( this, wxID_ANY, wxT("Magnet tracking"), wxDefaultPosition, wxSize(115, -1), wxTE_CENTER | wxTE_READONLY ); magnetZone->SetBackgroundColour( *wxLIGHT_GREY ); wxFont magnet_font = magnetZone->GetFont(); magnet_font.SetPointSize( 10 ); @@ -428,7 +428,7 @@ TrackingWindow::TrackingWindow( wxWindow *pParent, MainFrame *pMf, wxWindowID id pBoxMagnet1->Add( m_pBtnPlaceMagnetB, 1, wxEXPAND | wxALL, 1 ); m_pTrackingSizer->Add( pBoxMagnet1, 0, wxFIXED_MINSIZE | wxEXPAND, 0 ); - m_pTrackingSizer->Add( m_pToggleMagnetMode, 1, wxEXPAND | wxALL, 1 ); + m_pTrackingSizer->Add( m_pToggleMagnetMode, 1, wxEXPAND | wxALL, 1 );*/ }