Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
4551755f
Commit
4551755f
authored
Nov 23, 2010
by
Alexander Wiebel
Browse files
[ADD
#438
] WMReadSphericalHarmonics can now read data set as spherical
harmonics if they are double
parent
0d66cff3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
12 deletions
+54
-12
src/dataHandler/WDataHandlerEnums.h
src/dataHandler/WDataHandlerEnums.h
+12
-1
src/dataHandler/io/WReaderNIfTI.cpp
src/dataHandler/io/WReaderNIfTI.cpp
+2
-2
src/dataHandler/io/WReaderNIfTI.h
src/dataHandler/io/WReaderNIfTI.h
+1
-1
src/modules/readSphericalHarmonics/WMReadSphericalHarmonics.cpp
...dules/readSphericalHarmonics/WMReadSphericalHarmonics.cpp
+33
-4
src/modules/readSphericalHarmonics/WMReadSphericalHarmonics.h
...modules/readSphericalHarmonics/WMReadSphericalHarmonics.h
+6
-4
No files found.
src/dataHandler/WDataHandlerEnums.h
View file @
4551755f
...
...
@@ -28,7 +28,7 @@
#include <stdint.h>
/**
* Data
set
types and number values taken from the nifti1.h, at this point it's unknown if it makes sense
* Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense
* to keep the bit coding, but it doesn't hurt either
* \ingroup dataHandler
*/
...
...
@@ -173,6 +173,17 @@ enum qformOrientation
Inferior_to_Superior
};
/**
* Data set types. Not complete! Only those used for distinctions so far.
* \ingroup dataHandler
*/
enum
DataSetType
{
W_DATASET_NONE
=
0
,
W_DATASET_SINGLE
=
1
,
W_DATASET_SPHERICALHARMONICS
=
2
};
/**
* \defgroup dataHandler Data Handler
*
...
...
src/dataHandler/io/WReaderNIfTI.cpp
View file @
4551755f
...
...
@@ -83,7 +83,7 @@ wmath::WMatrix< double > WReaderNIfTI::convertMatrix( const mat44& in )
return
out
;
}
boost
::
shared_ptr
<
WDataSet
>
WReaderNIfTI
::
load
()
boost
::
shared_ptr
<
WDataSet
>
WReaderNIfTI
::
load
(
DataSetType
dataSetType
)
{
nifti_image
*
header
=
nifti_image_read
(
m_fname
.
c_str
(),
0
);
...
...
@@ -186,7 +186,7 @@ boost::shared_ptr< WDataSet > WReaderNIfTI::load()
// }
// else
if
(
description
.
compare
(
"WDataSetSphericalHarmonics"
)
==
0
)
if
(
description
.
compare
(
"WDataSetSphericalHarmonics"
)
==
0
||
dataSetType
==
W_DATASET_SPHERICALHARMONICS
)
{
wlog
::
debug
(
"WReaderNIfTI"
)
<<
"Load as spherical harmonics"
<<
std
::
endl
;
newDataSet
=
boost
::
shared_ptr
<
WDataSet
>
(
new
WDataSetSphericalHarmonics
(
newValueSet
,
newGrid
)
);
...
...
src/dataHandler/io/WReaderNIfTI.h
View file @
4551755f
...
...
@@ -60,7 +60,7 @@ public:
*
* \return the dataset loaded.
*/
virtual
boost
::
shared_ptr
<
WDataSet
>
load
();
virtual
boost
::
shared_ptr
<
WDataSet
>
load
(
DataSetType
dataSetType
=
W_DATASET_NONE
);
protected:
private:
...
...
src/modules/readSphericalHarmonics/WMReadSphericalHarmonics.cpp
View file @
4551755f
...
...
@@ -24,8 +24,10 @@
#include <string>
#include "../../kernel/WKernel.h"
#include "../../dataHandler/WDataHandlerEnums.h"
#include "../../dataHandler/io/WReaderNIfTI.h"
#include "../../graphicsEngine/WGERequirement.h"
#include "../../kernel/WKernel.h"
#include "WMReadSphericalHarmonics.xpm"
#include "WMReadSphericalHarmonics.h"
...
...
@@ -74,7 +76,10 @@ void WMReadSphericalHarmonics::connectors()
void
WMReadSphericalHarmonics
::
properties
()
{
// Put the code for your properties here. See "src/modules/template/" for an extensively documented example.
m_propCondition
=
boost
::
shared_ptr
<
WCondition
>
(
new
WCondition
()
);
m_dataFile
=
m_properties
->
addProperty
(
"NIfTI file"
,
""
,
WPathHelper
::
getAppPath
()
);
m_readTriggerProp
=
m_properties
->
addProperty
(
"Do read"
,
"Press!"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
m_propCondition
);
WPropertyHelper
::
PC_PATHEXISTS
::
addTo
(
m_dataFile
);
WModule
::
properties
();
}
...
...
@@ -86,6 +91,30 @@ void WMReadSphericalHarmonics::requirements()
void
WMReadSphericalHarmonics
::
moduleMain
()
{
// Put the code for your module's main functionality here.
// See "src/modules/template/" for an extensively documented example.
m_moduleState
.
add
(
m_propCondition
);
ready
();
while
(
!
m_shutdownFlag
()
)
{
m_moduleState
.
wait
();
if
(
m_shutdownFlag
()
)
{
break
;
}
std
::
string
fileName
=
m_dataFile
->
get
().
string
();
WReaderNIfTI
niiLoader
(
fileName
);
boost
::
shared_ptr
<
WDataSet
>
data
;
data
=
niiLoader
.
load
(
W_DATASET_SPHERICALHARMONICS
);
if
(
data
)
{
m_data
=
boost
::
shared_dynamic_cast
<
WDataSetSphericalHarmonics
>
(
data
);
if
(
m_data
)
{
m_runtimeName
->
set
(
string_utils
::
tokenize
(
fileName
,
"/"
).
back
()
);
m_output
->
updateData
(
m_data
);
}
}
m_readTriggerProp
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
}
}
src/modules/readSphericalHarmonics/WMReadSphericalHarmonics.h
View file @
4551755f
...
...
@@ -102,10 +102,12 @@ protected:
private:
/**
* The only output of this data module.
*/
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSetSphericalHarmonics
>
>
m_output
;
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSetSphericalHarmonics
>
>
m_output
;
//!< Ouput connector provided by this module.
boost
::
shared_ptr
<
WDataSetSphericalHarmonics
>
m_data
;
//!< This triangle mesh is provided as output through the connector.
boost
::
shared_ptr
<
WCondition
>
m_propCondition
;
//!< A condition used to notify about changes in several properties.
WPropTrigger
m_readTriggerProp
;
//!< This property triggers the actual reading,
WPropFilename
m_dataFile
;
//!< The data will be read from this file.
};
#endif // WMREADSPHERICALHARMONICS_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment