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
11452c24
Commit
11452c24
authored
Jun 01, 2010
by
reichenbach
Browse files
[FIX] removed HARDIEXtractor files
parent
85179250
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
485 deletions
+0
-485
src/modules/HARDIExtractor/CMakeLists.txt
src/modules/HARDIExtractor/CMakeLists.txt
+0
-8
src/modules/HARDIExtractor/HARDIExtractor.xpm
src/modules/HARDIExtractor/HARDIExtractor.xpm
+0
-40
src/modules/HARDIExtractor/WMHARDIExtractor.cpp
src/modules/HARDIExtractor/WMHARDIExtractor.cpp
+0
-287
src/modules/HARDIExtractor/WMHARDIExtractor.h
src/modules/HARDIExtractor/WMHARDIExtractor.h
+0
-150
No files found.
src/modules/HARDIExtractor/CMakeLists.txt
deleted
100644 → 0
View file @
85179250
FILE
(
GLOB_RECURSE MODULES_SRC
"*.cpp"
"*.h"
)
# Unit tests
IF
(
OW_COMPILE_TESTS
)
CXXTEST_ADD_TESTS_FROM_LIST
(
"
${
MODULES_SRC
}
"
"kernel"
)
ENDIF
(
OW_COMPILE_TESTS
)
src/modules/HARDIExtractor/HARDIExtractor.xpm
deleted
100644 → 0
View file @
85179250
/* XPM */
static const char * HARDIExtractor_xpm[] = {
"32 32 5 1",
" c #FFFFFF",
". c #D2D2D2",
"+ c #9C9C9C",
"@ c #6C6C6C",
"# c #3C3C3C",
" ",
" .............. ",
" .............. ",
" .............. ",
" ++++++++++++++. ",
" ++++++++++++++. ",
" ++++++++++++++. ",
" ++++++++++++++. ",
" ++++++++++++++. ",
" ++++++++++++++. ",
" ++++++++++++++. ",
" +++++++++@@@@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ##############@@@@@@@@@@@ ",
" ############## "};
src/modules/HARDIExtractor/WMHARDIExtractor.cpp
deleted
100644 → 0
View file @
85179250
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV-Leipzig and CNCF-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <string>
#include <sstream>
#include <vector>
#include "../../kernel/WKernel.h"
#include "../../dataHandler/WDataHandler.h"
#include "HARDIExtractor.xpm"
#include "WMHARDIExtractor.h"
WMHARDIExtractor
::
WMHARDIExtractor
()
:
WModule
()
{
}
WMHARDIExtractor
::~
WMHARDIExtractor
()
{
}
boost
::
shared_ptr
<
WModule
>
WMHARDIExtractor
::
factory
()
const
{
return
boost
::
shared_ptr
<
WModule
>
(
new
WMHARDIExtractor
()
);
}
const
std
::
string
WMHARDIExtractor
::
getName
()
const
{
return
"HARDI Extractor"
;
}
const
std
::
string
WMHARDIExtractor
::
getDescription
()
const
{
return
"This module allows extracting of single images from a HARDI dataset."
;
}
const
char
**
WMHARDIExtractor
::
getXPMIcon
()
const
{
return
HARDIExtractor_xpm
;
}
void
WMHARDIExtractor
::
connectors
()
{
m_input
=
boost
::
shared_ptr
<
WModuleInputData
<
WDataSetRawHARDI
>
>
(
new
WModuleInputData
<
WDataSetRawHARDI
>
(
shared_from_this
(),
"in"
,
"The HARDI dataset."
)
);
addConnector
(
m_input
);
m_output
=
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSetScalar
>
>
(
new
WModuleOutputData
<
WDataSetScalar
>
(
shared_from_this
(),
"out"
,
"The extracted image."
)
);
addConnector
(
m_output
);
WModule
::
connectors
();
}
void
WMHARDIExtractor
::
properties
()
{
m_propCondition
=
boost
::
shared_ptr
<
WCondition
>
(
new
WCondition
()
);
m_selectedImage
=
m_properties
->
addProperty
(
"Image"
,
"The image to be extracted."
,
0
,
m_propCondition
);
m_selectedImage
->
setMin
(
0
);
m_selectedImage
->
setMax
(
1
);
}
void
WMHARDIExtractor
::
moduleMain
()
{
m_moduleState
.
setResetable
(
true
,
true
);
m_moduleState
.
add
(
m_input
->
getDataChangedCondition
()
);
m_moduleState
.
add
(
m_propCondition
);
ready
();
while
(
!
m_shutdownFlag
()
)
{
m_moduleState
.
wait
();
if
(
m_shutdownFlag
()
)
{
break
;
}
boost
::
shared_ptr
<
WDataSetRawHARDI
>
newDataSet
=
m_input
->
getData
();
bool
dataChanged
=
(
m_dataSet
!=
newDataSet
);
bool
dataValid
=
(
newDataSet
);
if
(
dataChanged
&&
dataValid
)
{
m_dataSet
=
newDataSet
;
m_selectedImage
->
setMax
(
m_dataSet
->
getMeasures
()
-
1
);
m_selectedImage
->
ensureValidity
(
0
);
}
if
(
dataValid
)
{
if
(
m_outData
)
{
WDataHandler
::
deregisterDataSet
(
m_outData
);
}
std
::
size_t
i
=
static_cast
<
std
::
size_t
>
(
m_selectedImage
->
get
(
true
)
);
m_outData
=
extract
(
i
);
m_outData
->
setFileName
(
makeImageName
(
i
)
);
m_output
->
updateData
(
m_outData
);
if
(
m_outData
)
{
WDataHandler
::
registerDataSet
(
m_outData
);
}
}
}
if
(
m_outData
)
{
WDataHandler
::
deregisterDataSet
(
m_outData
);
}
}
boost
::
shared_ptr
<
WDataSetScalar
>
WMHARDIExtractor
::
extract
(
std
::
size_t
i
)
const
{
WAssert
(
m_dataSet
,
""
);
WAssert
(
m_dataSet
->
getValueSet
(),
""
);
WAssert
(
m_dataSet
->
getGrid
(),
""
);
if
(
i
>=
m_dataSet
->
getMeasures
()
)
{
return
boost
::
shared_ptr
<
WDataSetScalar
>
();
}
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
m_dataSet
->
getGrid
()
);
WAssert
(
grid
,
""
);
switch
(
m_dataSet
->
getValueSet
()
->
getDataType
()
)
{
case
W_DT_FLOAT
:
{
std
::
vector
<
float
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
float
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
float
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
float
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
float
>
>
(
new
WValueSet
<
float
>
(
0
,
1
,
values
,
W_DT_FLOAT
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_DOUBLE
:
{
std
::
vector
<
double
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
double
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
double
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
double
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
double
>
>
(
new
WValueSet
<
double
>
(
0
,
1
,
values
,
W_DT_DOUBLE
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_UINT8
:
{
std
::
vector
<
unsigned
char
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
(
new
WValueSet
<
unsigned
char
>
(
0
,
1
,
values
,
W_DT_UINT8
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_UINT16
:
{
std
::
vector
<
uint16_t
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
uint16_t
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
uint16_t
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
uint16_t
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
uint16_t
>
>
(
new
WValueSet
<
uint16_t
>
(
0
,
1
,
values
,
W_DT_UINT16
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_UINT32
:
{
std
::
vector
<
unsigned
int
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
unsigned
int
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
int
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
unsigned
int
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
unsigned
int
>
>
(
new
WValueSet
<
unsigned
int
>
(
0
,
1
,
values
,
W_DT_UINT32
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_INT8
:
{
std
::
vector
<
char
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
char
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
char
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
char
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
char
>
>
(
new
WValueSet
<
char
>
(
0
,
1
,
values
,
W_DT_INT8
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_INT16
:
{
std
::
vector
<
int16_t
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int16_t
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
(
new
WValueSet
<
int16_t
>
(
0
,
1
,
values
,
W_DT_INT16
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
case
W_DT_SIGNED_INT
:
{
std
::
vector
<
int
>
values
(
m_dataSet
->
getGrid
()
->
size
()
);
boost
::
shared_ptr
<
WValueSet
<
int
>
>
v
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int
>
>
(
m_dataSet
->
getValueSet
()
);
WAssert
(
v
,
""
);
for
(
std
::
size_t
k
=
0
;
k
<
grid
->
size
();
++
k
)
{
values
[
k
]
=
v
->
rawData
()[
m_dataSet
->
getMeasures
()
*
k
+
i
];
}
boost
::
shared_ptr
<
WValueSet
<
int
>
>
vs
=
boost
::
shared_ptr
<
WValueSet
<
int
>
>
(
new
WValueSet
<
int
>
(
0
,
1
,
values
,
W_DT_SIGNED_INT
)
);
return
boost
::
shared_ptr
<
WDataSetScalar
>
(
new
WDataSetScalar
(
vs
,
grid
)
);
}
default:
warnLog
()
<<
"Encountered unsupported data format in HARDIExtractor!"
;
return
boost
::
shared_ptr
<
WDataSetScalar
>
();
}
}
const
std
::
string
WMHARDIExtractor
::
makeImageName
(
std
::
size_t
i
)
{
std
::
stringstream
s
;
WAssert
(
m_dataSet
,
""
);
s
<<
m_dataSet
->
getFileName
()
<<
" ("
<<
(
i
+
1
)
<<
" of "
<<
m_dataSet
->
getMeasures
()
<<
")"
;
return
s
.
str
();
}
src/modules/HARDIExtractor/WMHARDIExtractor.h
deleted
100644 → 0
View file @
85179250
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV-Leipzig and CNCF-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMHARDIEXTRACTOR_H
#define WMHARDIEXTRACTOR_H
#include <string>
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../dataHandler/WDataSetRawHARDI.h"
#include "../../dataHandler/WValueSet.h"
/**
* This module extracts single images fram a HARDI dataset.
*
* \ingroup modules
*/
class
WMHARDIExtractor
:
public
WModule
{
public:
/**
* Standard constructor.
*/
WMHARDIExtractor
();
/**
* Destructor.
*/
virtual
~
WMHARDIExtractor
();
/**
* Gives back the name of this module.
* \return the module's name.
*/
virtual
const
std
::
string
getName
()
const
;
/**
* Gives back a description of this module.
* \return description to module.
*/
virtual
const
std
::
string
getDescription
()
const
;
/**
* Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
* should never be initialized or modified in some other way. A simple new instance is required.
*
* \return the prototype used to create every module in OpenWalnut.
*/
virtual
boost
::
shared_ptr
<
WModule
>
factory
()
const
;
/**
* Return an icon for this module.
*
* \return the icon
*/
virtual
const
char
**
getXPMIcon
()
const
;
protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
moduleMain
();
/**
* Initialize the connectors this module is using.
*/
virtual
void
connectors
();
/**
* Initialize the properties for this module.
*/
virtual
void
properties
();
private:
/**
* Extract the ith image from the HARDI dataset. If there is no
* ith image, an invalid pointer will be returned.
*
* \param i The number of the image to be extracted.
* \return A pointer to extracted image as a scalar dataset or an invalid pointer, if no ith image exists.
*/
boost
::
shared_ptr
<
WDataSetScalar
>
extract
(
std
::
size_t
i
)
const
;
/**
* Create a name for the extracted image.
*
* \param i The number of the image.
* \return The name.
*/
const
std
::
string
makeImageName
(
std
::
size_t
i
);
/**
* A property that allows selecting the number of the desired image.
*/
WPropInt
m_selectedImage
;
/**
* An input connector that accepts HARDI datasets.
*/
boost
::
shared_ptr
<
WModuleInputData
<
WDataSetRawHARDI
>
>
m_input
;
/**
* An output connector for the output scalar dsataset.
*/
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSetScalar
>
>
m_output
;
/**
* This is a pointer to the dataset the module is currently working on.
*/
boost
::
shared_ptr
<
WDataSetRawHARDI
>
m_dataSet
;
/**
* This is a pointer to the current output.
*/
boost
::
shared_ptr
<
WDataSetScalar
>
m_outData
;
/**
* A condition used to notify about changes in several properties.
*/
boost
::
shared_ptr
<
WCondition
>
m_propCondition
;
};
#endif // WMHARDIEXTRACTOR_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