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
12a20b2d
Commit
12a20b2d
authored
May 31, 2010
by
Sebastian Eichelbaum
Browse files
[MERGE]
parents
e2a4b31d
764e1087
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
35 deletions
+30
-35
src/dataHandler/WDataSetVector.cpp
src/dataHandler/WDataSetVector.cpp
+5
-0
src/dataHandler/WDataSetVector.h
src/dataHandler/WDataSetVector.h
+7
-0
src/dataHandler/io/WLoaderNIfTI.cpp
src/dataHandler/io/WLoaderNIfTI.cpp
+16
-6
src/graphicsEngine/WGEUtils.cpp
src/graphicsEngine/WGEUtils.cpp
+1
-28
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+1
-1
No files found.
src/dataHandler/WDataSetVector.cpp
View file @
12a20b2d
...
...
@@ -145,3 +145,8 @@ wmath::WVector3D WDataSetVector::getVectorAt( size_t index ) const
return
wmath
::
WVector3D
(
0
,
0
,
0
);
}
bool
WDataSetVector
::
isTexture
()
const
{
return
false
;
}
src/dataHandler/WDataSetVector.h
View file @
12a20b2d
...
...
@@ -81,6 +81,13 @@ public:
*/
wmath
::
WVector3D
getVectorAt
(
size_t
index
)
const
;
/**
* Determines whether this dataset can be used as a texture.
*
* \return true if usable as texture.
*/
virtual
bool
isTexture
()
const
;
/**
* Overwrites the isVectorDataSet check.
*
...
...
src/dataHandler/io/WLoaderNIfTI.cpp
View file @
12a20b2d
...
...
@@ -83,23 +83,33 @@ wmath::WMatrix< double > WLoaderNIfTI::convertMatrix( const mat44& in )
boost
::
shared_ptr
<
WDataSet
>
WLoaderNIfTI
::
load
()
{
nifti_image
*
header
=
nifti_image_read
(
m_fileName
.
c_str
(),
0
);
WAssert
(
header
,
"Error during file access to NIfTI file. This probably means that the file is corrupted."
);
WAssert
(
header
->
ndim
>=
3
,
"The NIfTI file contains data that has less than the three spatial dimension. OpenWalnut is not able to handle this."
);
int
columns
=
header
->
dim
[
1
];
int
rows
=
header
->
dim
[
2
];
int
frames
=
header
->
dim
[
3
];
boost
::
shared_ptr
<
WValueSetBase
>
newValueSet
;
boost
::
shared_ptr
<
WGrid
>
newGrid
;
boost
::
shared_ptr
<
WGrid
>
newGrid
;
nifti_image
*
filedata
=
nifti_image_read
(
m_fileName
.
c_str
(),
1
);
unsigned
int
vDim
=
header
->
dim
[
4
];
unsigned
int
vDim
;
if
(
header
->
ndim
>=
4
)
{
vDim
=
header
->
dim
[
4
];
}
else
{
vDim
=
1
;
}
unsigned
int
order
=
(
(
vDim
==
1
)
?
0
:
1
);
// TODO(all): Does recognize vectors and scalars only so far.
unsigned
int
countVoxels
=
columns
*
rows
*
frames
;
#ifdef DEBUG
//nifti_image_infodump( header );
#endif
switch
(
header
->
datatype
)
{
case
DT_UNSIGNED_CHAR
:
...
...
src/graphicsEngine/WGEUtils.cpp
View file @
12a20b2d
...
...
@@ -26,8 +26,6 @@
#include <osg/Array>
#include <GL/glu.h>
#include "../common/math/WPosition.h"
#include "WGEUtils.h"
...
...
@@ -45,30 +43,5 @@ osg::ref_ptr< osg::Vec3Array > wge::osgVec3Array( const std::vector< wmath::WPos
osg
::
Vec3
wge
::
unprojectFromScreen
(
const
osg
::
Vec3
screen
,
osg
::
ref_ptr
<
osg
::
Camera
>
camera
)
{
double
*
modelView
;
double
*
projection
;
double
dviewport
[
4
];
modelView
=
camera
->
getViewMatrix
().
ptr
();
projection
=
camera
->
getProjectionMatrix
().
ptr
();
dviewport
[
0
]
=
camera
->
getViewport
()
->
x
();
dviewport
[
1
]
=
camera
->
getViewport
()
->
y
();
dviewport
[
2
]
=
camera
->
getViewport
()
->
width
();
dviewport
[
3
]
=
camera
->
getViewport
()
->
height
();
double
x
,
y
,
z
;
GLint
viewport
[
4
];
viewport
[
0
]
=
static_cast
<
GLint
>
(
dviewport
[
0
]
);
viewport
[
1
]
=
static_cast
<
GLint
>
(
dviewport
[
1
]
);
viewport
[
2
]
=
static_cast
<
GLint
>
(
dviewport
[
2
]
);
viewport
[
3
]
=
static_cast
<
GLint
>
(
dviewport
[
3
]
);
gluUnProject
(
screen
[
0
],
screen
[
1
],
screen
[
2
],
modelView
,
projection
,
viewport
,
&
x
,
&
y
,
&
z
);
osg
::
Vec3
world
;
world
[
0
]
=
x
;
world
[
1
]
=
y
;
world
[
2
]
=
z
;
return
world
;
return
screen
*
osg
::
Matrix
::
inverse
(
camera
->
getViewMatrix
()
*
camera
->
getProjectionMatrix
()
*
camera
->
getViewport
()
->
computeWindowMatrix
()
);
}
src/gui/qt4/WMainWindow.cpp
View file @
12a20b2d
...
...
@@ -293,7 +293,7 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
boost
::
shared_ptr
<
WMData
>
dataModule
=
boost
::
shared_static_cast
<
WMData
>
(
module
);
// grab data and identify type
if
(
dataModule
->
getDataSet
()
->
isA
<
WDataSetSingle
>
()
)
if
(
dataModule
->
getDataSet
()
->
isA
<
WDataSetSingle
>
()
&&
dataModule
->
getDataSet
()
->
isTexture
()
)
{
// it is a dataset single
// load a nav slice module if a WDataSetSingle is available!?
...
...
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