Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
722382c4
Commit
722382c4
authored
Jun 01, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REMOVE] - removed overlayAtlas. Was not ported to new colormapping.
parent
c194b83f
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
2043 deletions
+0
-2043
src/modules/modules-base.toolbox
src/modules/modules-base.toolbox
+0
-1
src/modules/overlayAtlas/WAtlasSlice.cpp
src/modules/overlayAtlas/WAtlasSlice.cpp
+0
-159
src/modules/overlayAtlas/WAtlasSlice.h
src/modules/overlayAtlas/WAtlasSlice.h
+0
-229
src/modules/overlayAtlas/WMOverlayAtlas.cpp
src/modules/overlayAtlas/WMOverlayAtlas.cpp
+0
-755
src/modules/overlayAtlas/WMOverlayAtlas.h
src/modules/overlayAtlas/WMOverlayAtlas.h
+0
-291
src/modules/overlayAtlas/WMOverlayAtlas.xpm
src/modules/overlayAtlas/WMOverlayAtlas.xpm
+0
-425
src/modules/overlayAtlas/shaders/WMOverlayAtlas-fragment.glsl
...modules/overlayAtlas/shaders/WMOverlayAtlas-fragment.glsl
+0
-138
src/modules/overlayAtlas/shaders/WMOverlayAtlas-vertex.glsl
src/modules/overlayAtlas/shaders/WMOverlayAtlas-vertex.glsl
+0
-45
No files found.
src/modules/modules-base.toolbox
View file @
722382c4
...
...
@@ -15,7 +15,6 @@ ADD_MODULE( isosurfaceRaytracer )
ADD_MODULE( lic "" ".*fibernavigator.*;.*fantom.*;" ) # lic uses some third party code
ADD_MODULE( marchingCubes )
ADD_MODULE( navigationSlices )
# ADD_MODULE( overlayAtlas )
ADD_MODULE( paintTexture )
ADD_MODULE( superquadricGlyphs )
ADD_MODULE( template ) # template has its own CMakeLists for demonstration purpose
...
...
src/modules/overlayAtlas/WAtlasSlice.cpp
deleted
100644 → 0
View file @
c194b83f
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-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 <iostream>
#include <string>
#include "core/common/WLogger.h"
#include "WAtlasSlice.h"
WAtlasSlice
::
WAtlasSlice
(
std
::
string
path
,
WOASliceOrientation
orientation
,
float
position
,
float
left
,
float
bottom
,
float
right
,
float
top
)
:
m_path
(
path
),
m_orientation
(
orientation
),
m_position
(
position
),
m_left
(
left
),
m_bottom
(
bottom
),
m_right
(
right
),
m_top
(
top
),
m_dirty
(
true
)
{
if
(
loadImage
()
)
{
switch
(
orientation
)
{
case
OA_AXIAL
:
break
;
case
OA_CORONAL
:
createTextureCoronal
();
break
;
case
OA_SAGITTAL
:
break
;
}
}
}
WAtlasSlice
::~
WAtlasSlice
()
{
}
bool
WAtlasSlice
::
loadImage
()
{
m_image
=
osgDB
::
readImageFile
(
m_path
);
if
(
!
m_image
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"Could't find image"
,
"WAtlasSlice"
,
LL_ERROR
);
return
false
;
}
return
true
;
}
osg
::
ref_ptr
<
osg
::
Texture3D
>
WAtlasSlice
::
getImage
()
{
return
m_texture
;
}
boost
::
shared_ptr
<
WGridRegular3D
>
WAtlasSlice
::
getGrid
()
{
if
(
m_dirty
)
{
createGridCoronal
();
}
return
m_grid
;
}
void
WAtlasSlice
::
createTextureCoronal
()
{
m_newImage
=
new
osg
::
Image
;
m_newImage
->
allocateImage
(
m_image
->
s
(),
m_image
->
r
(),
m_image
->
t
(),
m_image
->
getPixelFormat
(),
m_image
->
getDataType
()
);
unsigned
char
*
data
=
m_image
->
data
();
unsigned
char
*
newData
=
m_newImage
->
data
();
for
(
unsigned
int
i
=
0
;
i
<
m_image
->
getTotalSizeInBytes
();
++
i
)
{
newData
[
i
]
=
data
[
i
];
}
m_texture
=
osg
::
ref_ptr
<
osg
::
Texture3D
>
(
new
osg
::
Texture3D
);
m_texture
->
setFilter
(
osg
::
Texture3D
::
MIN_FILTER
,
osg
::
Texture3D
::
LINEAR
);
m_texture
->
setFilter
(
osg
::
Texture3D
::
MAG_FILTER
,
osg
::
Texture3D
::
LINEAR
);
m_texture
->
setWrap
(
osg
::
Texture
::
WRAP_S
,
osg
::
Texture
::
CLAMP_TO_BORDER
);
m_texture
->
setWrap
(
osg
::
Texture
::
WRAP_T
,
osg
::
Texture
::
CLAMP_TO_BORDER
);
m_texture
->
setWrap
(
osg
::
Texture
::
WRAP_R
,
osg
::
Texture
::
CLAMP_TO_BORDER
);
m_texture
->
setImage
(
m_newImage
);
m_texture
->
setResizeNonPowerOfTwoHint
(
false
);
}
void
WAtlasSlice
::
createGridCoronal
()
{
float
sizeX
=
(
m_right
-
m_left
)
/
m_image
->
s
();
float
sizeY
=
(
m_top
-
m_bottom
)
/
m_image
->
t
();
WMatrix
<
double
>
mat
(
4
,
4
);
mat
.
makeIdentity
();
mat
(
0
,
0
)
=
sizeX
;
mat
(
1
,
1
)
=
2.0
;
mat
(
2
,
2
)
=
sizeY
;
mat
(
0
,
3
)
=
m_left
;
mat
(
1
,
3
)
=
m_position
;
mat
(
2
,
3
)
=
m_bottom
;
m_grid
=
boost
::
shared_ptr
<
WGridRegular3D
>
(
new
WGridRegular3D
(
m_newImage
->
s
(),
m_newImage
->
t
(),
m_newImage
->
r
(),
WGridTransformOrtho
(
mat
)
)
);
m_dirty
=
false
;
}
void
WAtlasSlice
::
setPosition
(
float
pos
)
{
m_position
=
pos
;
m_dirty
=
true
;
}
void
WAtlasSlice
::
setLeft
(
float
left
)
{
m_left
=
left
;
m_dirty
=
true
;
}
void
WAtlasSlice
::
setBottom
(
float
bottom
)
{
m_bottom
=
bottom
;
m_dirty
=
true
;
}
void
WAtlasSlice
::
setRight
(
float
right
)
{
m_right
=
right
;
m_dirty
=
true
;
}
void
WAtlasSlice
::
setTop
(
float
top
)
{
m_top
=
top
;
m_dirty
=
true
;
}
src/modules/overlayAtlas/WAtlasSlice.h
deleted
100644 → 0
View file @
c194b83f
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-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 WATLASSLICE_H
#define WATLASSLICE_H
#include <string>
#include <osg/Image>
#include <osg/Texture3D>
#include <osgDB/ReadFile>
#include "core/dataHandler/WGridRegular3D.h"
typedef
enum
{
OA_AXIAL
=
0
,
OA_CORONAL
,
OA_SAGITTAL
}
WOASliceOrientation
;
/**
* class encapsulates one slice of an overlay collection
*/
class
WAtlasSlice
{
public:
/**
* standard constructor
*
* this loads an image from a file and creates a 3D texture object which is aligned in spase and positioned
* according to additional info given
*
* \param path to the image file
* \param orientation slice orientation ( axial, coronal or sagittal )
* \param position
* \param left boundary
* \param bottom boundary
* \param right boundary
* \param top boundary
*/
WAtlasSlice
(
std
::
string
path
,
WOASliceOrientation
orientation
,
float
position
,
float
left
,
float
bottom
,
float
right
,
float
top
);
/**
* destructor
*/
~
WAtlasSlice
();
/**
* getter
*
* \return the osg texture object
*/
osg
::
ref_ptr
<
osg
::
Texture3D
>
getImage
();
/**
* getter
* \return the grid for the texture
*/
boost
::
shared_ptr
<
WGridRegular3D
>
getGrid
();
/**
* getter
*
* \return path to the image
*/
std
::
string
path
();
/**
* getter
*
* \return
*/
float
position
();
/**
* getter
*/
float
left
();
/**
* getter
*/
float
bottom
();
/**
* getter
*/
float
right
();
/**
* getter
*/
float
top
();
/**
* setter
* \param pos position of the slice
*/
void
setPosition
(
float
pos
);
/**
* setter
* \param left left boundary
*/
void
setLeft
(
float
left
);
/**
* setter
* \param bottom lower boundary
*/
void
setBottom
(
float
bottom
);
/**
* setter
* \param right right boundary
*/
void
setRight
(
float
right
);
/**
* setter
* \param top upper boundary
*/
void
setTop
(
float
top
);
protected:
private:
/**
* helper function for loading an image from file
* \return true if succesful
*/
bool
loadImage
();
/**
* creates a 3D texture from the loaded image
*/
void
createTextureCoronal
();
/**
* creates a grid for the texture
*/
void
createGridCoronal
();
std
::
string
m_path
;
//!< path to the gfx
osg
::
Image
*
m_image
;
//!< osg image object for the loaded image
osg
::
Image
*
m_newImage
;
//!< osg image object for texture generation,
WOASliceOrientation
m_orientation
;
//!< slice orientation
float
m_position
;
//!< position
float
m_left
;
//!< left boundary
float
m_bottom
;
//!< lower boundary
float
m_right
;
//!< right boundary
float
m_top
;
//!< upper boundary
boost
::
shared_ptr
<
WGridRegular3D
>
m_grid
;
//!< grid for the texture
/**
* stores a pointer to the texture we paint in
*/
osg
::
ref_ptr
<
osg
::
Texture3D
>
m_texture
;
bool
m_dirty
;
//!< dirty flag
};
inline
std
::
string
WAtlasSlice
::
path
()
{
return
m_path
;
}
inline
float
WAtlasSlice
::
position
()
{
return
m_position
;
}
inline
float
WAtlasSlice
::
left
()
{
return
m_left
;
}
inline
float
WAtlasSlice
::
bottom
()
{
return
m_bottom
;
}
inline
float
WAtlasSlice
::
right
()
{
return
m_right
;
}
inline
float
WAtlasSlice
::
top
()
{
return
m_top
;
}
#endif // WATLASSLICE_H
src/modules/overlayAtlas/WMOverlayAtlas.cpp
deleted
100644 → 0
View file @
c194b83f
This diff is collapsed.
Click to expand it.
src/modules/overlayAtlas/WMOverlayAtlas.h
deleted
100644 → 0
View file @
c194b83f
//---------------------------------------------------------------------------
//
// 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 WMOVERLAYATLAS_H
#define WMOVERLAYATLAS_H
#include <string>
#include <vector>
#include <osg/Geode>
#include "core/graphicsEngine/WGEManagedGroupNode.h"
#include "core/graphicsEngine/WROISphere.h"
#include "core/kernel/WModule.h"
#include "core/kernel/WModuleInputData.h"
#include "core/kernel/WModuleOutputData.h"
#include "WAtlasSlice.h"
/**
* This module loads pictures from usual image file (png, jpeg) and displays them on slices
*
* \ingroup modules
*/
class
WMOverlayAtlas
:
public
WModule
{
public:
/**
* constructor
*/
WMOverlayAtlas
();
/**
* destructor
*/
virtual
~
WMOverlayAtlas
();
/**
* 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
;
/**
* Get the icon for this module in XPM format.
*/
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
();
/**
* updates the plane with the current settings
*/
void
updatePlane
();
/**
* updates textures and shader parameters
*/
void
updateTextures
();
/**
* creates and initializes the uniform parameters for the shader
* \param rootState The uniforms will be applied to this state.
*/
void
initUniforms
(
osg
::
StateSet
*
rootState
);
/**
* Used as callback which simply sets m_textureChanged to true. Called by WSubject whenever the datasets change.
*/
void
notifyTextureChange
();
/**
* setter for dirty flag
*/
void
setDirty
();
/**
* getter
* \return dirty flag
*/
bool
isDirty
();
private:
/**
* helper function to read a text file
* \param fileName
* \return string containing the file
*/
std
::
vector
<
std
::
string
>
readFile
(
const
std
::
string
fileName
);
/**
* loads and parses the meta file
* \param path to the meta file
* \return true if a meta file was succesfully loaded, false otherwise
*/
bool
loadAtlas
(
boost
::
filesystem
::
path
path
);
/**
* updates the texture on a coronal oriented slice depending on hte module's settings
*/
void
updateCoronalSlice
();
/**
* listener function for property changes
*
* \param property - the property which fired the event
*/
void
propertyChanged
(
boost
::
shared_ptr
<
WPropertyBase
>
property
);
/**
* initializes the drawable elements of the module
*/
void
init
();
/**
* called when texture manipulators are moved int he scene
*/
void
manipulatorMoved
();
/**
* hides/unhides the manipulators
*/
void
toggleManipulators
();
/**
* update callback for osg node traversal
*/
void
updateCallback
();
/**
* A condition used to notify about changes in several properties.
*/
boost
::
shared_ptr
<
WCondition
>
m_propCondition
;
/**
* helper function converts a string into a float
* \param s the string
* \return float
*/
float
s2f
(
std
::
string
s
);
WPropTrigger
m_propReadTrigger
;
//!< This property triggers the actual reading,
WPropFilename
m_propMetaFile
;
//!< The tree will be read from this file, i hope we will get a real load button some time
WPropBool
m_showManipulators
;
//!< property controlling the display of the manipulator widgets
WPropInt
m_propCoronalSlicePos
;
//!< property controlling which slice shopuld be shown
std
::
vector
<
WAtlasSlice
>
m_axialSlices
;
//!< vector containing image objects with axial orientation
std
::
vector
<
WAtlasSlice
>
m_coronalSlices
;
//!< vector containing image objects with coronal orientation
std
::
vector
<
WAtlasSlice
>
m_sagittalSlices
;
//!< vector containing image objects with sagittal orientation
WPosition
m_p0
;
//!< stores the last position of the center manipulator
WPosition
m_p1
;
//!< stores the last position of manipulator 1
WPosition
m_p2
;
//!< stores the last position of manipulator 2
WPosition
m_p3
;
//!< stores the last position of manipulator 3
WPosition
m_p4
;
//!< stores the last position of manipulator 4
boost
::
shared_ptr
<
WROISphere
>
m_s0
;
//!< stores pointer to the center manipulator
boost
::
shared_ptr
<
WROISphere
>
m_s1
;
//!< stores pointer to manipulator 1
boost
::
shared_ptr
<
WROISphere
>
m_s2
;
//!< stores pointer to manipulator 2
boost
::
shared_ptr
<
WROISphere
>
m_s3
;
//!< stores pointer to manipulator 3
boost
::
shared_ptr
<
WROISphere
>
m_s4
;
//!< stores pointer to manipulator 4
bool
m_dirty
;
//!< dirty flag, used when manipulator positions change
/**
* The root node used for this modules graphics.
*/
osg
::
ref_ptr
<
WGEManagedGroupNode
>
m_rootNode
;
/**
* The geometry rendered by this module.
*/
osg
::
ref_ptr
<
osg
::
Geode
>
m_geode
;
/**
* True when textures have changed.
*/
bool
m_textureChanged
;
/**
* the shader object for this module
*/
osg
::
ref_ptr
<
WGEShader
>
m_shader
;
/**
* True if the shader shouldn't discard a fragment when the value is zero
*/
WPropBool
m_showComplete
;
/**
* vector of uniforms for type of texture
*/
std
::
vector
<
osg
::
ref_ptr
<
osg
::
Uniform
>
>
m_typeUniforms
;
/**
* vector of alpha values per texture