Commit 55832a1a authored by Alexander Wiebel's avatar Alexander Wiebel

[ADD #119] implemented empty module draft for distance map.

parent cc352f6e
//---------------------------------------------------------------------------
//
// 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 <string>
#include "WMDistanceMap.h"
#include "../../kernel/WKernel.h"
WMDistanceMap::WMDistanceMap():
WModule()
{
// WARNING: initializing connectors inside the constructor will lead to an exception.
// Implement WModule::initializeConnectors instead.
}
WMDistanceMap::~WMDistanceMap()
{
// cleanup
removeConnectors();
}
boost::shared_ptr< WModule > WMDistanceMap::factory() const
{
return boost::shared_ptr< WModule >( new WMDistanceMap() );
}
const std::string WMDistanceMap::getName() const
{
return "Distance Map";
}
const std::string WMDistanceMap::getDescription() const
{
return "This description has to be improved when the module is completed."
" By now lets say the following: Computes a smoothed version of the dataset"
" and a distance map on it. Finally it renders this distance map using MarchinCubes";
}
void WMDistanceMap::moduleMain()
{
// TODO(wiebel): MC fix this hack when possible by using an input connector.
while ( !WKernel::getRunningKernel() )
{
sleep( 1 );
}
while ( !WKernel::getRunningKernel()->getDataHandler() )
{
sleep( 1 );
}
while ( !WKernel::getRunningKernel()->getDataHandler()->getNumberOfSubjects() )
{
sleep( 1 );
}
}
void WMDistanceMap::connectors()
{
// initialize connectors
m_input = boost::shared_ptr<WModuleInputData< boost::shared_ptr< WDataSet > > >(
new WModuleInputData< boost::shared_ptr< WDataSet > >( shared_from_this(),
"in", "Dataset to compute isosurface for." )
);
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
addConnector( m_input );
// call WModules initialization
WModule::connectors();
}
void WMDistanceMap::properties()
{
// ( m_properties->addDouble( "isoValue", 80 ) )->connect( boost::bind( &WMMarchingCubes::slotPropertyChanged, this, _1 ) );
}
//---------------------------------------------------------------------------
//
// 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 WMDISTANCEMAP_H
#define WMDISTANCEMAP_H
#include <string>
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.hpp"
/**
* Computes a distance map from an anatomy dataset and renders it as isosurface.
*/
class WMDistanceMap : public WModule
{
/**
* Only UnitTests may be friends.
*/
friend class WMDistanceMapTest;
public:
/**
* Standard constructor.
*/
WMDistanceMap();
/**
* Destructor.
*/
~WMDistanceMap();
/**
* 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 of 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;
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< boost::shared_ptr< WDataSet > > > m_input; //!< Input connector required by this module.
};
#endif // WMDISTANCEMAP_H
//---------------------------------------------------------------------------
//
// 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 WMDISTANCEMAP_TEST_H
#define WMDISTANCEMAP_TEST_H
#include <cxxtest/TestSuite.h>
#include "../WMDistanceMap.h"
/**
* TODO(wiebel): Document this!
*/
class WMDistanceMapTest : public CxxTest::TestSuite
{
public:
/**
* TODO(wiebel): Document this!
*/
void testSomething( void )
{
}
};
#endif // WMDISTANCEMAP_TEST_H
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