Git Product home page Git Product logo

beamadapter's Introduction

BeamAdapter plugin

Documentation Support Gitter

Description

This SOFA plugin implements a 1-dimensional Finite Element Method (FEM) based on the Kirchhoff rod theory and allows to simulate any 1D flexible structure, like catheters, guidewires or coils in a medical context.

This plugin proposes an adaptive implementation allowing for the interactive deployment of one or several concentric tools. This approach is therefore especially well designed for interventional radiology interventions, more especially the simulation of a catheter deployment.

Build instructions

This plugin relies on the open-source project SOFA. To build the sources of this plugin, you can follow the associated "Build a plugin from sources" documentation page.

Documentation

Related publications

If you are using this code in your research work, please cite us!

If this work is useful for your industrial application, your support would be most welcome.

beamadapter's People

Contributors

adagolodjo avatar alxbilger avatar bakpaul avatar bcarrez avatar camille-k avatar christianduriez avatar damienmarchal avatar dequidt avatar epernod avatar eulaliecoevoet avatar fjourdes avatar fredroy avatar guparan avatar hugtalbot avatar marwaeldiwiny1991 avatar meichun avatar olivier-goury avatar olivier-roussel avatar p-shg avatar peyronq1 avatar vannestefelix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

beamadapter's Issues

Inconsistent EOL

The files on the repository have different endings, and it leads in some issue with editors which change all of them while developing, thus completely wiping out the blame/history in those files.

Status:

$ find . -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.inl" \) -exec file {} \;
./src/BeamAdapter/initBeamAdapter.h: C source, ASCII text
./src/BeamAdapter/initBeamAdapter.cpp: C source, ASCII text
./src/BeamAdapter/component/MultiAdaptiveBeamContactMapper.h: C++ source, ASCII text, with CRLF, LF line terminators
./src/BeamAdapter/component/AdaptiveBeamContactMapper.h: C++ source, ASCII text, with CRLF, LF line terminators
./src/BeamAdapter/component/MultiAdaptiveBeamContactMapper.cpp: C++ source, ASCII text
./src/BeamAdapter/component/WireBeamInterpolation.h: C++ source, ASCII text
./src/BeamAdapter/component/controller/AdaptiveBeamController.inl: C++ source, Unicode text, UTF-8 text
./src/BeamAdapter/component/controller/InterventionalRadiologyController.cpp: C source, ASCII text, with CRLF, LF line terminators
./src/BeamAdapter/component/controller/SutureController.h: C++ source, ASCII text
./src/BeamAdapter/component/controller/InterventionalRadiologyController.inl: C++ source, Unicode text, UTF-8 text
./src/BeamAdapter/component/controller/SutureController.cpp: C++ source, ASCII text
./src/BeamAdapter/component/controller/SutureController.inl: C++ source, Unicode text, UTF-8 text, with CRLF, LF line terminators
./src/BeamAdapter/component/controller/InterventionalRadiologyController.h: C++ source, ASCII text
./src/BeamAdapter/component/controller/AdaptiveBeamController.cpp: C++ source, ASCII text
./src/BeamAdapter/component/controller/AdaptiveBeamController.h: C++ source, ASCII text
./src/BeamAdapter/component/BeamInterpolation.inl: C++ source, ASCII text, with CRLF line terminators
./src/BeamAdapter/component/engine/WireRestShape.cpp: C++ source, ASCII text
./src/BeamAdapter/component/engine/SteerableCatheter.cpp: C source, ASCII text
./src/BeamAdapter/component/engine/SteerableCatheter.h: C++ source, ASCII text
./src/BeamAdapter/component/engine/SteerableCatheter.inl: C++ source, Unicode text, UTF-8 text
./src/BeamAdapter/component/engine/WireRestShape.h: C++ source, ASCII text
./src/BeamAdapter/component/engine/WireRestShape.inl: C++ source, Unicode text, UTF-8 text
./src/BeamAdapter/component/MultiAdaptiveBeamContactMapper.inl: C++ source, ASCII text
./src/BeamAdapter/component/BeamInterpolation.cpp: C++ source, ASCII text
./src/BeamAdapter/component/AdaptiveBeamContactMapper.inl: C++ source, ASCII text
./src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp: C++ source, ASCII text
./src/BeamAdapter/component/mapping/BeamLengthMapping.cpp: C++ source, ASCII text
./src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.h: C++ source, ASCII text
./src/BeamAdapter/component/mapping/BeamLengthMapping.inl: C++ source, ASCII text
./src/BeamAdapter/component/mapping/AdaptiveBeamMapping.h: C++ source, ASCII text
./src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.inl: C++ source, ASCII text
./src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl: C++ source, ASCII text
./src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.cpp: C source, ASCII text
./src/BeamAdapter/component/mapping/BeamLengthMapping.h: C++ source, ASCII text
./src/BeamAdapter/component/AdaptiveBeamFrictionContact.cpp: C++ source, ASCII text
./src/BeamAdapter/component/WireBeamInterpolation.inl: C++ source, Unicode text, UTF-8 text, with CRLF, LF line terminators
./src/BeamAdapter/component/WireBeamInterpolation.cpp: C++ source, ASCII text
./src/BeamAdapter/component/AdaptiveBeamContactMapper.cpp: C++ source, ASCII text
./src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl: C++ source, Unicode text, UTF-8 text, with CRLF line terminators
./src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.inl: C++ source, Unicode text, UTF-8 text, with CRLF, LF line terminators
./src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.h: C++ source, ASCII text
./src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.cpp: C source, ASCII text
./src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.cpp: C source, ASCII text
./src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h: C++ source, ASCII text
./src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.cpp: C++ source, ASCII text, with CRLF, LF line terminators
./src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.cpp: C++ source, ASCII text, with CRLF line terminators
./src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.inl: C++ source, ASCII text
./src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.h: C++ source, ASCII text
./src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.inl: C++ source, ASCII text
./src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.h: C++ source, ASCII text
./src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.h: C++ source, ASCII text
./src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.cpp: C source, ASCII text
./src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.inl: C++ source, ASCII text
./src/BeamAdapter/component/BeamInterpolation.h: C++ source, Unicode text, UTF-8 text, with CRLF line terminators
./src/BeamAdapter/component/solver/UnbuiltGenericConstraintSolver.h: C++ source, ASCII text
./src/BeamAdapter/component/solver/UnbuiltGenericConstraintSolver.cpp: C++ source, ASCII text
./src/BeamAdapter/utils/deprecatedcomponent.h: C++ source, ASCII text
./BeamAdapter_test/BeamInterpolation_test.cpp: C++ source, ASCII text
./BeamAdapter_test/component/mapping/BeamLengthMappingTest.cpp: C++ source, ASCII text
./BeamAdapter_test/component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp: C++ source, ASCII text
./BeamAdapter_test/component/constraint/AdaptiveBeamSlidingConstraintTest.cpp: C++ source, ASCII text

As we can see BeamInterpolation.{h, inl},, AdaptiveBeamSlidingConstraint.cpp, AdaptiveBeamForceFieldAndMass.inl have CRLF defined, others even have a mix of CRLF/LF defined...
I dont really know how to fix easily that, without destroying the history (either completely replace the content of the file, or by git-filter the complete history of the repo)
In any case, we should be careful while doing PR, diff/conflicts are really a mess because of this ๐Ÿ™ˆ

Ninja build subcommand failing

Hello,

I'm running Ubuntu 18.04 with Ninja 1.10.2 and gcc-9 and have successfully built sofa, but I am running into issues building this plugin as an in-tree build.

The following two lines are the only specific indication of which files may be failing:
<FAILED: external_directories/ext_plugin_repo/BeamAdapter/CMakeFiles/BeamAdapter.dir/src/BeamAdapter/component/BeamInterpolation.cpp.o>
<FAILED: external_directories/ext_plugin_repo/BeamAdapter/CMakeFiles/BeamAdapter.dir/src/BeamAdapter/component/WireBeamInterpolation.cpp.o>

I'm not sure if this is because I'm missing a dependency or my version of Ninja is not compatible.
I didn't see any similar issues on this forum, so I assume it is something simple I have forgotten. Also, the full failure message is much longer, but I can attach if it is useful.

Thanks in advance!

Strange second tool "corkscrew tail" behavior

When using very small tip length/spireDiameter The edge Discretization behave strangely. Or problem of rigidity or beamMapping ?

SOFA.v22.12.99.-.C__projects_sofa_plugins_SofaLnRobotics_scenes_Demo_02_synthetic_data.scn.2022-09-16.09-59-47.-.0.00.02-0.00.14.mp4

Scene to reproduce the behavior

<?xml version="1.0"?>
<Node name="root" dt="0.05"  gravity="0 0 0"> 
	<Node name="Plugins">
        <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->  
        <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->  
        <RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Edge2QuadTopologicalMapping] -->  
        <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->  
        <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [EdgeSetGeometryAlgorithms, EdgeSetTopologyContainer, EdgeSetTopologyModifier, QuadSetGeometryAlgorithms, QuadSetTopologyContainer, QuadSetTopologyModifier] -->  
        <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->  
        <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->  
        <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RestShapeSpringsForceField] -->  
        <RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->  
        <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->  
        <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->  
        <RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [BTDLinearSolver] -->  
        <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->  
        <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->  
        <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->  
        <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] -->  
        <RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [DefaultContactManager] -->  
        <RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel, PointCollisionModel, TriangleCollisionModel] -->  
        <RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [LocalMinDistance] -->  
        <RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase, BruteForceBroadPhase, DefaultPipeline] -->  
        <RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->  
        <RequiredPlugin name="BeamAdapter" />
	</Node>
    <VisualStyle displayFlags="hideVisualModels showBehaviorModels hideMappings hideForceFields showCollisionModels" />
 	<DefaultVisualManagerLoop/>

 	<FreeMotionAnimationLoop />
	<LCPConstraintSolver mu="0.1" tolerance="1e-4" maxIt="1000" build_lcp="false" />
	
    <DefaultPipeline depth="6" verbose="1" draw="0"/>
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <LocalMinDistance name="localmindistance" alarmDistance="0.2" contactDistance="0.1" angleCone="0.02"/>
    <DefaultContactManager name="Response" response="FrictionContactConstraint" />

	<Node name="GuideCatheter">
		<WireRestShape template="Rigid3d" name="GC_RestShape" length="500.0" straightLength="499.5" 
            spireDiameter="0.4" spireHeight="0.0" radius="1" massDensity="0.1" poissonRatio="0.3"
			densityOfBeams="350 5" numEdgesCollis="350 10" 
            youngModulus="400" youngModulusExtremity="200" />

		<EdgeSetTopologyContainer name="GC_mesh" />
		<EdgeSetTopologyModifier />
		<EdgeSetGeometryAlgorithms template="Rigid3d" />
		<MechanicalObject name="GC_dof" template="Rigid3d" />
	</Node>


	<Node name='GuideWire'>
		<WireRestShape template='Rigid3d' name='GW_RestShape' length='100.0'  straightLength='99.8' 
            spireDiameter='0.15' spireHeight='0.0' radius="1"
			densityOfBeams='350 6' numEdgesCollis='350 6'  
            youngModulus='200' youngModulusExtremity='100'/>
            
		<EdgeSetTopologyContainer name='GW_mesh' />
		<EdgeSetTopologyModifier />
		<EdgeSetGeometryAlgorithms template='Rigid3d' />
		<MechanicalObject template='Rigid3d' name='GC_dof' />
	</Node>


    <Node name="Instrument">
        <EulerImplicitSolver rayleighStiffness="0.2" rayleighMass="0.1" />
        <BTDLinearSolver />
        <RegularGridTopology name="MeshLines" nx="60" ny="1" nz="1"
            xmax="0.0" xmin="0.0" ymin="0" ymax="0" zmax="0" zmin="0"
            p0="0 0 0" drawEdges="0"/>
                                
        <MechanicalObject name="Instrument_DOFs" template="Rigid3d" translation="96.0 6.0 6.5" rotation="0 30 -70" /> 
        
        <WireBeamInterpolation name="Interpol_GCatheter" WireRestShape="@../GuideCatheter/GC_RestShape" radius="0.05" printLog="0"/> 
		<AdaptiveBeamForceFieldAndMass name="FF_GCatheter" interpolation="@Interpol_GCatheter" massDensity="0.00000155"/>

		<WireBeamInterpolation name='Interpol_GWire' WireRestShape='@../GuideWire/GW_RestShape' radius='0.01' printLog='0'/> 
		<AdaptiveBeamForceFieldAndMass name='FF_GWire' interpolation='@Interpol_GWire' massDensity='0.0000000155'/> 	



        <InterventionalRadiologyController name="IRController" template="Rigid3d" listening="true" controlledInstrument="0" 
            instruments="Interpol_GCatheter Interpol_GWire" printLog="0" 
            speed="0"  step="0.1" startingPos="96.0 6.0 6.5   0 0 0 1" 
            rotationInstrument="0 0 0" xtip="0 0 0"  />


        <LinearSolverConstraintCorrection printLog="false" wire_optimization="true"/>
        
        <FixedConstraint name="FixedConstraint" indices="0" />
        <RestShapeSpringsForceField  points="@IRController.indexFirstNode" stiffness="1e8" angularStiffness="1e8" />

        <Node name="Instrument_collision" activated="true">
				<EdgeSetTopologyContainer name="IC_mesh"/>
				<EdgeSetTopologyModifier />
				<MechanicalObject name="IC_dofs"/>
				<MultiAdaptiveBeamMapping  name="IC_MultiBeamMapping" controller="../IRController" useCurvAbs="1" printLog="0"/> 
				<LineCollisionModel proximity="0.0" group="1"/>
				<PointCollisionModel proximity="0.0" group="1"/>
		</Node>	
    </Node>
</Node>

Import error

Hi, when I try to add BeamAdapter plugin to sofa, it came with this erroor

[ERROR]   [PluginManager] Plugin loading failed (/home/yangyang/sofa/build/install/plugins/BeamAdapter/lib/libBeamAdapter.so): /home/yangyang/sofa/build/install/plugins/BeamAdapter/lib/libBeamAdapter.so: undefined symbol: _ZN4sofa10simulation21BaseMechanicalVisitor5beginEPNS0_4NodeEPNS_4core11objectmodel10BaseObjectERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

Im using sofa 23.12 the pre-compiled version, whats wrong with the sofa or this plugin?
looking forward to your replay, thanks!

Crash if FixedConstraint is not present

[ERROR] [InterventionalRadiologyController(DeployController)] No fixedConstraint found.

########## SIG 11 - SIGSEGV: segfault ##########
sofa::helper::BackTrace::dump
sofa::helper::BackTrace::sig
seh_filter_exe
seh_filter_exe
_C_specific_handler
_chkstk
RtlRaiseException
KiUserExceptionDispatcher
sofa::component::constraint::projective::ProjectToLineConstraint<sofa::defaulttype::StdVectorTypes<sofa::type::Vec<2,double>,sofa::type::Vec<2,double>,double> >::clearConstraints
sofa::component::controller::interventionalradiologycontroller::InterventionalRadiologyController<sofa::defaulttype::StdRigidTypes<3,double> >::fixFirstNodesWithUntil

Change of behaviour in InterventionalRadiologyController

I believe that the modifications made in #62 (specifically in this commit) introduced a slight change of behaviour in the interventionalRadiologyComputeSampling method of the InterventionalRadiologyController.

I have the impression that these lines (487-493) in the former version :

  if (curvAbs_xP>0.0)   // all the noticiable point that have a negative curv abs are not simulated => considered as outside of the patient...
  {
      newCurvAbs.push_back(curvAbs_xP);

      if (curvAbs_xP > maxAbsLength)
          maxAbsLength=curvAbs_xP;
  }

implied that the keyPoints of each instrument were always taken into account when computing the new curvilinear abscissas, whether the instrument was visible or not.
Whereas in the new version, I think that these keyPoints are only added to the new curvilinear abscissas if the instrument is visible (i.e. if the tip of the instrument is further deployed than the tips of outter instruments with a higher radius).

NB: the second condition in the lines above, however, seems to be unused in the rest of the method
NB2: it seems I can't assign you on this @epernod, I don't have access to the functionality ๐Ÿ™ƒ

Function convertBeamAdapterAction not used

I just noticed the following warning:

BeamAdapter/src/BeamAdapter/utils/BeamActions.h:58:30: warning: unused function 'convertBeamAdapterAction' [-Wunused-function]
    static BeamAdapterAction convertBeamAdapterAction(const std::string& sAction)
                             ^

Is there a reason why it is not used?

Components depending on SofaAdvancedConstraint

Some components are compiled only if the package SofaAdvancedConstraint is found (see CMakeLists.txt). I believe this module no longer exists. The CMakeLists.txt file must be updated according to the new architecture (or drop the components).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.