-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] ENH,MAINT: Porting MNE Scan source plugins to MNE Analyze #901
Open
gabrielbmotta
wants to merge
17
commits into
mne-tools:main
Choose a base branch
from
gabrielbmotta:source_loc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ef37e24
Add skeleton for forward solution plugin
gabrielbmotta 8392171
Add gui for fwd
gabrielbmotta 43bd949
MAINT: incorporating ui elements to control fwd solution settings
gabrielbmotta 9dfa1e2
Adding singla/slot code usedin GUI
gabrielbmotta 10eef14
Port fwd solution computation
gabrielbmotta cbd4c16
Add fwd sol model
gabrielbmotta 019b57b
Add new mne_analyze event types, get relevant data to fwd and source …
gabrielbmotta 924abce
Check fwd sol files. Get data to where it is needed
gabrielbmotta 42278d3
huge waste of tiome because qt did no regenerate ui files
gabrielbmotta 6eeb201
Fix time waste from qt
gabrielbmotta c3266c4
Connect code to settings
gabrielbmotta eb340bc
Debug fwd solution
gabrielbmotta b1f883b
Start porting source loc code
gabrielbmotta 859f7f7
Port cov, invop, mne, source est code
gabrielbmotta ef1a459
Add source_loc_model
gabrielbmotta fc26dcf
Add source loc gui and add get functions to model
gabrielbmotta 3d0ec9e
Adding get/set functions in SE model. Load data into 3d view.
gabrielbmotta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
applications/mne_analyze/libs/anShared/Model/forwardsolutionmodel.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
//============================================================================================================= | ||
/** | ||
* @file forwardsolutionmodel.cpp | ||
* @author Gabriel Motta <[email protected]> | ||
* @since 0.1.9 | ||
* @date October, 2022 | ||
* | ||
* @section LICENSE | ||
* | ||
* Copyright (C) 2022, Gabriel Motta. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that | ||
* the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the | ||
* following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and | ||
* the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* * Neither the name of MNE-CPP authors nor the names of its contributors may be used | ||
* to endorse or promote products derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* | ||
* @brief Definition of the ForwardSolutionModel Class. | ||
* | ||
*/ | ||
|
||
|
||
//============================================================================================================= | ||
// INCLUDES | ||
//============================================================================================================= | ||
|
||
#include "forwardsolutionmodel.h" | ||
|
||
#include <mne/mne_forwardsolution.h> | ||
|
||
//============================================================================================================= | ||
// QT INCLUDES | ||
//============================================================================================================= | ||
|
||
|
||
//============================================================================================================= | ||
// Eigen INCLUDES | ||
//============================================================================================================= | ||
|
||
|
||
//============================================================================================================= | ||
// USED NAMESPACES | ||
//============================================================================================================= | ||
|
||
using namespace ANSHAREDLIB; | ||
|
||
//============================================================================================================= | ||
// DEFINE MEMBER METHODS | ||
//============================================================================================================= | ||
|
||
ForwardSolutionModel::ForwardSolutionModel(QObject* parent) | ||
:AbstractModel(parent) | ||
{ | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
ForwardSolutionModel::ForwardSolutionModel(QSharedPointer<MNELIB::MNEForwardSolution> pFwdSolution, | ||
QObject* parent) | ||
: AbstractModel( parent) | ||
, m_pFwdSolution(pFwdSolution) | ||
{ | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
int ForwardSolutionModel::rowCount(const QModelIndex &parent) const | ||
{ | ||
Q_UNUSED(parent); | ||
|
||
return 1; | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
int ForwardSolutionModel::columnCount(const QModelIndex &parent) const | ||
{ | ||
Q_UNUSED(parent); | ||
|
||
return 1; | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
QVariant ForwardSolutionModel::data(const QModelIndex &index, | ||
int role) const | ||
{ | ||
Q_UNUSED(index); | ||
Q_UNUSED(role); | ||
|
||
return QVariant::fromValue(m_pFwdSolution); | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
Qt::ItemFlags ForwardSolutionModel::flags(const QModelIndex &index) const | ||
{ | ||
return QAbstractItemModel::flags(index); | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
QSharedPointer<MNELIB::MNEForwardSolution> ForwardSolutionModel::getFwdSolution() | ||
{ | ||
return m_pFwdSolution; | ||
} |
174 changes: 174 additions & 0 deletions
174
applications/mne_analyze/libs/anShared/Model/forwardsolutionmodel.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
//============================================================================================================= | ||
/** | ||
* @file forwardsolutionmodel.h | ||
* @author Gabriel Motta <[email protected]> | ||
* @since 0.1.9 | ||
* @date October, 2022 | ||
* | ||
* @section LICENSE | ||
* | ||
* Copyright (C) 2022, Gabriel Motta. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that | ||
* the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the | ||
* following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and | ||
* the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* * Neither the name of MNE-CPP authors nor the names of its contributors may be used | ||
* to endorse or promote products derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* | ||
* @brief Declaration of the ForwardSolutionModel Class. | ||
* | ||
*/ | ||
|
||
#ifndef FORWARDSOLUTIONMODEL_H | ||
#define FORWARDSOLUTIONMODEL_H | ||
|
||
//============================================================================================================= | ||
// INCLUDES | ||
//============================================================================================================= | ||
|
||
#include "../anshared_global.h" | ||
#include "../Utils/types.h" | ||
#include "abstractmodel.h" | ||
|
||
//============================================================================================================= | ||
// FORWARD DECLARATIONS | ||
//============================================================================================================= | ||
|
||
namespace MNELIB { | ||
class MNEForwardSolution; | ||
} | ||
|
||
//============================================================================================================= | ||
// DEFINE NAMESPACE ANSHAREDLIB | ||
//============================================================================================================= | ||
|
||
namespace ANSHAREDLIB { | ||
|
||
//============================================================================================================= | ||
class ANSHAREDSHARED_EXPORT ForwardSolutionModel : public AbstractModel | ||
{ | ||
Q_OBJECT | ||
public: | ||
typedef QSharedPointer<ForwardSolutionModel> SPtr; /**< Shared pointer type for ForwardSolutionModel. */ | ||
typedef QSharedPointer<const ForwardSolutionModel> ConstSPtr; /**< Const shared pointer type for ForwardSolutionModel. */ | ||
|
||
public: | ||
//========================================================================================================= | ||
ForwardSolutionModel(QObject* parent = Q_NULLPTR); | ||
|
||
//========================================================================================================= | ||
ForwardSolutionModel(QSharedPointer<MNELIB::MNEForwardSolution> pFwdSolution, | ||
QObject* parent = Q_NULLPTR); | ||
|
||
//========================================================================================================= | ||
/** | ||
* Returns the number of rows in the model | ||
* | ||
* @param[in] parent The parent index. | ||
*/ | ||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||
|
||
//========================================================================================================= | ||
/** | ||
* Returns the number of columns in the model | ||
* | ||
* @param[in] parent The parent index. | ||
*/ | ||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; | ||
|
||
//========================================================================================================= | ||
/** | ||
* Returns the data stored under the given role for the index. | ||
* | ||
* @param[in] index The index that referres to the requested item. | ||
* @param[in] role The requested role. | ||
*/ | ||
virtual QVariant data(const QModelIndex &index, | ||
int role = Qt::DisplayRole) const override; | ||
|
||
//========================================================================================================= | ||
/** | ||
* Returns the item flags for the given index. | ||
* | ||
* @param[in] index The index that referres to the requested item. | ||
*/ | ||
Qt::ItemFlags flags(const QModelIndex & index) const override; | ||
|
||
//========================================================================================================= | ||
/** | ||
* The type of this model (CovarianceModel) | ||
* | ||
* @return The type of this model (CovarianceModel). | ||
*/ | ||
inline MODEL_TYPE getType() const override; | ||
|
||
//========================================================================================================= | ||
/** | ||
* Returns the index for the item in the model specified by the given row, column and parent index. | ||
* Currently only Qt::DisplayRole is supported. | ||
* Index rows reflect channels, first column is channel names, second is raw data. | ||
* | ||
* @param[in] row The specified row. | ||
* @param[in] column The specified column. | ||
* @param[in] parent The parent index. | ||
*/ | ||
inline QModelIndex index(int row, | ||
int column, | ||
const QModelIndex &parent = QModelIndex()) const override; | ||
|
||
//========================================================================================================= | ||
/** | ||
* Returns the parent index of the given index. | ||
* In this Model the parent index in always QModelIndex(). | ||
* | ||
* @param[in] index The index that referres to the child. | ||
*/ | ||
inline QModelIndex parent(const QModelIndex &index) const override; | ||
|
||
QSharedPointer<MNELIB::MNEForwardSolution> getFwdSolution(); | ||
|
||
private: | ||
QSharedPointer<MNELIB::MNEForwardSolution> m_pFwdSolution; | ||
}; | ||
|
||
//============================================================================================================= | ||
// INLINE DEFINITIONS | ||
//============================================================================================================= | ||
|
||
inline MODEL_TYPE ForwardSolutionModel::getType() const | ||
{ | ||
return MODEL_TYPE::ANSHAREDLIB_FORWARDSOLUTION_MODEL; | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
QModelIndex ForwardSolutionModel::parent(const QModelIndex &index) const | ||
{ | ||
Q_UNUSED(index); | ||
return QModelIndex(); | ||
} | ||
|
||
//============================================================================================================= | ||
|
||
QModelIndex ForwardSolutionModel::index(int row, int column, const QModelIndex &parent) const | ||
{ | ||
Q_UNUSED(parent); | ||
return createIndex(row, column); | ||
} | ||
|
||
}//namespace | ||
|
||
#endif // FORWARDSOLUTIONMODEL_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a general comment: In cases of classes which are final in their inheritance scheme, I would only keep the override keyword and remove the virtual keyword.
I do not think that ForwardSolutionModel will be used as a base class. Maybe consider marking the whole class as final.