Commit bc6b46fc authored by Alexander Wiebel's avatar Alexander Wiebel

[ADD] module for storing fibers

parent 331538b4
......@@ -62,6 +62,7 @@
#include "../modules/vectorPlot/WMVectorPlot.h"
#include "../modules/voxelizer/WMVoxelizer.h"
#include "../modules/writeNIfTI/WMWriteNIfTI.h"
#include "../modules/writeTracts/WMWriteTracts.h"
#include "../modules/splineSurface/WMSplineSurface.h"
#include "../modules/atlasSurfaces/WMAtlasSurfaces.h"
#include "combiner/WApplyPrototypeCombiner.h"
......@@ -125,6 +126,7 @@ void WModuleFactory::load()
m_prototypeAccess->get().insert( boost::shared_ptr< WModule >( new WMVectorPlot() ) );
m_prototypeAccess->get().insert( boost::shared_ptr< WModule >( new WMVoxelizer() ) );
m_prototypeAccess->get().insert( boost::shared_ptr< WModule >( new WMWriteNIfTI() ) );
m_prototypeAccess->get().insert( boost::shared_ptr< WModule >( new WMWriteTracts() ) );
m_prototypeAccess->get().insert( boost::shared_ptr< WModule >( new WMSplineSurface() ) );
m_prototypeAccess->get().insert( boost::shared_ptr< WModule >( new WMAtlasSurfaces() ) );
......
//---------------------------------------------------------------------------
//
// 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 "../../common/WPropertyHelper.h"
#include "../../dataHandler/io/WWriterFiberVTK.h"
#include "../../kernel/WKernel.h"
#include "WMWriteTracts.h"
#include "writeTracts.xpm"
WMWriteTracts::WMWriteTracts():
WModule()
{
}
WMWriteTracts::~WMWriteTracts()
{
// Cleanup!
}
boost::shared_ptr< WModule > WMWriteTracts::factory() const
{
// See "src/modules/template/" for an extensively documented example.
return boost::shared_ptr< WModule >( new WMWriteTracts() );
}
const char** WMWriteTracts::getXPMIcon() const
{
return writeTracts_xpm;
}
const std::string WMWriteTracts::getName() const
{
return "Write Tracts";
}
const std::string WMWriteTracts::getDescription() const
{
// Specify your module description here. Be detailed. This text is read by the user.
// See "src/modules/template/" for an extensively documented example.
return "Someone should add some documentation here. "
"Probably the best person would be the modules's creator, i.e. \"wiebel\"";
}
void WMWriteTracts::connectors()
{
typedef WModuleInputData< const WFiberCluster > InputType; // just an alias
m_input = boost::shared_ptr< InputType >( new InputType( shared_from_this(), "voxelInput", "A loaded dataset with grid." ) );
addConnector( m_input );
// call WModules initialization
WModule::connectors();
}
void WMWriteTracts::properties()
{
m_savePath = m_properties->addProperty( "Save Path", "Where to save the result", boost::filesystem::path( "/no/such/file" ) );
WPropertyHelper::PC_NOTEMPTY::addTo( m_savePath );
}
void WMWriteTracts::moduleMain()
{
m_moduleState.add( m_input->getDataChangedCondition() );
// signal ready state
ready();
// loop until the module container requests the module to quit
while( !m_shutdownFlag() )
{
if( !m_input->getData() )
{
// ok, the output has not yet sent data
// NOTE: see comment at the end of this while loop for m_moduleState
debugLog() << "Waiting for data ...";
m_moduleState.wait();
continue;
}
WWriterFiberVTK w( m_savePath->get(), true );
w.writeFibs( m_input->getData()->getDataSetReference() );
// this waits for m_moduleState to fire. By default, this is only the m_shutdownFlag condition.
// NOTE: you can add your own conditions to m_moduleState using m_moduleState.add( ... )
m_moduleState.wait();
}
}
//---------------------------------------------------------------------------
//
// 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 WMWRITETRACTS_H
#define WMWRITETRACTS_H
#include <string>
#include <osg/Geode>
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
/**
* Someone should add some documentation here.
* Probably the best person would be the module's
* creator, i.e. "wiebel".
*
* This is only an empty template for a new module. For
* an example module containing many interesting concepts
* and extensive documentation have a look at "src/modules/template"
*
* \ingroup modules
*/
class WMWriteTracts: public WModule
{
public:
/**
*
*/
WMWriteTracts();
/**
*
*/
virtual ~WMWriteTracts();
/**
* 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();
private:
boost::shared_ptr< WModuleInputData< const WFiberCluster > > m_input; //!< Input connector for a fiber cluster
WPropFilename m_savePath; //!< Path where tracts should be stored
};
#endif // WMWRITETRACTS_H
/* XPM */
static const char * writeTracts_xpm[] = {
"16 16 88 1",
" c None",
". c #8162D6",
"+ c #7568DD",
"@ c #6366D8",
"# c #8479E0",
"$ c #8699DF",
"% c #827CD8",
"& c #7C71D9",
"* c #6251D2",
"= c #6C69D7",
"- c #7673DD",
"; c #9089E1",
"> c #8B9ADF",
", c #74C08A",
"' c #6597C1",
") c #6883CB",
"! c #698ECE",
"~ c #6B71D1",
"{ c #828CBA",
"] c #997DBA",
"^ c #8795E4",
"/ c #8BA5C4",
"( c #7CB0AF",
"_ c #85BD95",
": c #6B96B4",
"< c #53BF8A",
"[ c #6A8BBB",
"} c #7E98BB",
"| c #6C9B9F",
"1 c #4A8984",
"2 c #5E8E8B",
"3 c #8879AE",
"4 c #948EC5",
"5 c #8BA7BA",
"6 c #6DC298",
"7 c #60C673",
"8 c #66CC6D",
"9 c #7CABBA",
"0 c #63AC9D",
"a c #6CC963",
"b c #91AA8A",
"c c #8DA984",
"d c #8C9BB5",
"e c #4C63C8",
"f c #7D6FE5",
"g c #9FA3BF",
"h c #6BBC8E",
"i c #4DBE84",
"j c #66C476",
"k c #62CC5F",
"l c #6DC353",
"m c #71B792",
"n c #7DC669",
"o c #53BE78",
"p c #6D9E97",
"q c #85AE81",
"r c #8A987F",
"s c #8488AB",
"t c #917CE0",
"u c #78C4A4",
"v c #77C84D",
"w c #67B650",
"x c #7BA364",
"y c #74BC56",
"z c #58C24C",
"A c #70C669",
"B c #83B282",
"C c #65A18E",
"D c #58C96D",
"E c #7FB194",
"F c #5BC580",
"G c #63B76E",
"H c #70B974",
"I c #74B76F",
"J c #6FBD57",
"K c #69BD5E",
"L c #60B364",
"M c #53BF53",
"N c #6DC468",
"O c #000000",
"P c #54A9A1",
"Q c #63AFA2",
"R c #6DAE8C",
"S c #6FAE9C",
"T c #81C869",
"U c #81C664",
"V c #61AA82",
"W c #8D8F99",
" ",
" ",
" ",
" .+@# ",
" $%&*=-;> ",
" ,')!~{]^/(_ ",
" :<[}|12345678 ",
" 90abcdefghijkl ",
" mnopqrstuvwxyz ",
" ABCDEFGHIJKLMN ",
" O PQRS ",
" OO TUVW ",
"OOOOOOOO ",
"OOOOOOOO ",
" OO ",
" O "};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment