Commit 42cdd00f authored by promayon's avatar promayon
Browse files

FIXED preparing for ex-tetrahedralize last modification (i.e. generation .msh,...

FIXED preparing for ex-tetrahedralize last modification (i.e. generation .msh, .scn and .mml from any unstructured grid)

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@140 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 02a55a78
add_subdirectory(tetgen1.4.3)
if(MML_SOFA_SUPPORT)
#FIXME Sofa support => fix sofa dependency properly
if(WIN32)
......@@ -13,7 +11,7 @@ if(MML_SOFA_SUPPORT)
include_directories(${XERCESC_ROOT_DIR}/include)
endif()
action_extension(NEEDS_LIBXML2
action_extension(NEEDS_LIBXML2
INCLUDE_DIRECTORIES tetgen1.4.3
LIBRARIES tetgen
NEEDS_TOOL pml lml mml monitoringgui monitoring
......
......@@ -29,7 +29,7 @@ $CAMITK_LICENCE_END$
#include <lml/Translation.h>
#include <MultiComponent.h>
#include "Tetrahedralize.h"
#include "GenerateModel.h"
#include <Component.h>
#include <Log.h>
#include <Core.h>
......@@ -57,20 +57,19 @@ $CAMITK_LICENCE_END$
// -------------------- Tetrahedralize --------------------
Tetrahedralize::Tetrahedralize(ActionExtension* extension) : Action(extension) {
this->setName("Tetrahedralize");
setEmbedded(false);
this->setDescription("Generates a Delaunay tetrahedralization from the mesh points, msh, sofa scn, pml and corresponding lml");
// -------------------- GenerateModel --------------------
GenerateModel::GenerateModel(ActionExtension* extension) : Action(extension) {
this->setName("Generate Model");
this->setDescription("Generates a model from a mesh: mml, msh, sofa scn, pml and corresponding lml are generated");
this->setComponent("MeshComponent");
this->setFamily("Mesh Processing");
this->addTag("Tetrahedralize");
this->addTag("Build Biomechanical Model");
}
// --------------- apply -------------------
Action::ApplyStatus Tetrahedralize::apply() {
CAMITK_INFO("Tetrahedralize", "apply", "Tetrahedalizing " << getTargets().last()->getName().toStdString());
Action::ApplyStatus GenerateModel::apply() {
CAMITK_INFO("GenerateModel", "apply", "Tetrahedalizing " << getTargets().last()->getName().toStdString());
// set waiting cursor
QApplication::setOverrideCursor ( QCursor ( Qt::WaitCursor ) );
......@@ -227,8 +226,8 @@ Action::ApplyStatus Tetrahedralize::apply() {
//in.numberoffacets = 0;
// 4.2 Tetrahedralize the PLC
// Tetrahedralize the PLC. Switches are chosen to read a PLC (p),
// 4.2 GenerateModel the PLC
// GenerateModel the PLC. Switches are chosen to read a PLC (p),
// do quality mesh generation (q) with a specified quality bound
// (1.414), and apply a maximum volume constraint (a0.1).
// NOTE (warning) with the q option tetgen will add some vertex, the point list has to be updated!
......@@ -278,7 +277,7 @@ Action::ApplyStatus Tetrahedralize::apply() {
newPointSet->Update();
//-- 6. Generate vtk
// VtkMeshUtil::saveUnstructuredGridToFile(newPointSet, QString(QFileInfo(myComponent->getFileName()).completeBaseName() + "_Tetrahedralized.vtk").toStdString());
// VtkMeshUtil::saveUnstructuredGridToFile(newPointSet, QString(QFileInfo(myComponent->getFileName()).completeBaseName() + "_GenerateModeld.vtk").toStdString());
/*
//-- 6. generate the PML
......@@ -542,7 +541,7 @@ Action::ApplyStatus Tetrahedralize::apply() {
pml->xmlPrint(pmlofs);
pmlofs.close();
//CAMITK_INFO("Tetrahedralize", "apply", "parsing " << mmlFilename.toStdString());
//CAMITK_INFO("GenerateModel", "apply", "parsing " << mmlFilename.toStdString());
Application::getMainWindow()->open(mmlFilename);
// restore the normal cursor
......
......@@ -23,57 +23,22 @@ Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef TETRAHEDRALIZE_H
#define TETRAHEDRALIZE_H
#ifndef GENERATEMODEL_H
#define GENERATEMODEL_H
#include <Action.h>
using namespace camitk;
/** Use TetGen from http://tetgen.berlios.de to generate a
* Delaunay Tetrahedralization of the set of points of a mesh.
*
* Beware of the licence of TetGen before using this extension,
* an extract is copyied here to appear in this
* extension API documentation:
\verbatim
The software (TetGen) is licensed under the terms of the MIT license
with the following exceptions:
Distribution of modified versions of this code is permissible UNDER
THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE
SAME SOURCE FILES tetgen.h AND tetgen.cxx REMAIN UNDER COPYRIGHT OF
THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY
AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE
MODIFICATIONS.
Distribution of this code for any commercial purpose is permissible
ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNER.
\endverbatim
* The full license text is available in the file tetgen1.4.3/LICENSE.
*
* The code of this extension itself is available under the LGPL.
*
* \todo separates this actions inf sub-actions, for example:
* - tetrahedralize itself with a gui to set the tetgen parameters,
* input: mesh, output:mesh
* - export mesh to sofa (either similar to what is done here, or
* by using an export in the mml component)
* - create informative structural component from selection, or from
* bounding box (xmin and/or xmax and/or ymin and/or ymax etc...
* see the select pml tools
* \note each action directly done on pml should be programmed as
* a method in PMLTool.
* \todo test complete processing pipeline (from image to sofa model)
* with the truthcube and the truthcylinder
/** generate MML/Sofa scn from a vtk mesh
*/
class Tetrahedralize : public Action {
class GenerateModel : public Action {
public:
/// the constructor
Tetrahedralize(ActionExtension* extension);
GenerateModel(ActionExtension* extension);
/// the destructor
virtual ~Tetrahedralize() {};
virtual ~GenerateModel() {};
/// no widget yet
virtual QWidget * getWidget() { return NULL; }
......@@ -84,4 +49,4 @@ public slots:
};
#endif // TETRAHEDRALIZE_H
#endif // GENERATEMODEL_H
......@@ -22,14 +22,13 @@ Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include "TetrahedralizeExtension.h"
#include "Tetrahedralize.h"
#include "MMLActionExtension.h"
#include "GenerateModel.h"
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(tetrahedralize, TetrahedralizeExtension);
Q_EXPORT_PLUGIN2(mmlactionextension, MMLActionExtension);
// -------------------- init --------------------
void TetrahedralizeExtension::init() {
registerNewAction(Tetrahedralize);
void MMLActionExtension::init() {
registerNewAction(GenerateModel);
}
......@@ -23,8 +23,8 @@ Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef TETRAHEDRALIZE_EXTENSION_H
#define TETRAHEDRALIZE_EXTENSION_H
#ifndef MMLACTIONEXTENSION_H
#define MMLACTIONEXTENSION_H
#include <QObject>
#include <Action.h>
......@@ -32,19 +32,16 @@ $CAMITK_LICENCE_END$
using namespace camitk;
/// Class that manage the Tetrahedralize mesh extension
/// which generates a Delaunay tetrahedralization from the mesh points
/// using TetGen
class TetrahedralizeExtension : public ActionExtension {
class MMLActionExtension : public ActionExtension {
Q_OBJECT
Q_INTERFACES(camitk::ActionExtension);
public:
/// the constructor
TetrahedralizeExtension() : ActionExtension() {};
MMLActionExtension() : ActionExtension() {};
/// the destructor
virtual ~TetrahedralizeExtension() {};
virtual ~MMLActionExtension() {};
/// Method must be reimplemented when an ActionExtension is done,
/// the own actions of an extension are load there.
......@@ -52,13 +49,13 @@ public:
virtual void init();
/// Method that return the action extension name
virtual QString getName() {return "Tetrahedralize";};
virtual QString getName() {return "MML";};
/// Method that return the action extension descrption
virtual QString getDescription() {return "Generates a Delaunay tetrahedralization from the mesh points";};
virtual QString getDescription() {return "Various actions for MML";};
};
#endif // TETRAHEDRALIZE_EXTENSION_H
\ No newline at end of file
#endif // MMLACTIONEXTENSION_H
\ No newline at end of file
Supports Markdown
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