Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation on generating new scaffolds #182

Closed
DippedPretzels opened this issue Mar 14, 2022 · 6 comments
Closed

Documentation on generating new scaffolds #182

DippedPretzels opened this issue Mar 14, 2022 · 6 comments

Comments

@DippedPretzels
Copy link

Hi @rchristie, I'm wondering if there is any documentation on generating new scaffold types via segmented uCT datasets. I might be missing something, but I only see the mesh_generator plugin visible in mapclient, and this seems to only allow modification of existing scaffolds:
image
image
I'm running win10, with a python 3.7 environment in conda. Scaffoldmaker installed via these directions https://staging.sparc.science/help/getting-started-with-scaffoldmaker#top. Starting mapclient yields:

14/03/2022 - 10:31:43.728 - mapclient.application - INFO - --------------------------------
14/03/2022 - 10:31:43.728 - mapclient.application - INFO -    MAPClient (version 0.17.0)
14/03/2022 - 10:31:43.729 - mapclient.application - INFO - --------------------------------
14/03/2022 - 10:31:43.729 - mapclient.application - INFO - Setting toolbox settings for matplotlib and enthought to: qt
14/03/2022 - 10:31:44.165 - mapclient.application - INFO - OpenCMISS-Zinc is available.
14/03/2022 - 10:31:45.120 - mapclient.core.managers.pluginmanager - INFO - Loaded plugin 'filelocationsinkstep' version [0.2.0] by Richard Christie
14/03/2022 - 10:31:45.120 - mapclient.core.managers.pluginmanager - INFO - Plugin 'filelocationsinkstep' available from: https://github.com/mapclient-plugins/mapclientplugins.filelocationsinkstep
14/03/2022 - 10:31:45.723 - mapclient.core.managers.pluginmanager - INFO - Loaded plugin 'meshgeneratorstep' version [0.2.0] by Richard Christie
14/03/2022 - 10:31:45.724 - mapclient.core.managers.pluginmanager - INFO - Plugin 'meshgeneratorstep' has no location set.
14/03/2022 - 10:31:45.740 - mapclient.application - INFO - Opening workflow: C:/Users/spenc/AppData/Roaming/MusculoSkeletal\MAPClient-Workflows\sparc-data-mapping
14/03/2022 - 10:31:45.740 - mapclient.view.workflow.workflowwidget - INFO - Performing workflow checks on open ...
14/03/2022 - 10:31:45.744 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/mapclient-plugins/mapclientplugins.argonsceneexporterstep.git.
14/03/2022 - 10:31:45.902 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/mapclient-plugins/mapclientplugins.argonviewerstep.git.
14/03/2022 - 10:31:46.040 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/ABI-Software/mapclientplugins.geometricfitstep.
14/03/2022 - 10:31:46.179 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/mapclient-plugins/mapclientplugins.muxerstep.git.
14/03/2022 - 10:31:46.321 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/ABI-Software/mapclientplugins.dataembedderstep.
14/03/2022 - 10:31:46.462 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/ABI-Software/mbfxml2exconverterstep.git.
14/03/2022 - 10:31:46.605 - mapclient.core.managers.pluginmanager - INFO - Installing package : https://github.com/mapclient-plugins/mapclientplugins.filechooserstep.
14/03/2022 - 10:31:46.747 - mapclient.core.managers.workflowmanager - WARNING - Unable to load workflow.  You may need to restart the application.
14/03/2022 - 10:31:46.750 - mapclient.view.workflow.workflowwidget - ERROR - Invalid Workflow.  The given Workflow configuration file was not loaded. You may need to restart the application to pick up newly installed Python modules
@DippedPretzels
Copy link
Author

I do see the documentation here on making new mesh types, but these are for cubes and tubes: https://scaffoldmaker-documentation.readthedocs.io/en/latest/tutorials/creating_meshtype/creating_mesh_type.html
I can't find much information on how the organ scaffolds were originally created.

@rchristie
Copy link
Member

We're planning some new/official documentation right now; the site you've seen has been put together by some users at the ABI, so we'll try to merge in what is in those sites.
Regarding writing a new organ scaffold, you're best looking at and learning from the scripts in the meshtypes folder:
https://github.com/ABI-Software/scaffoldmaker/tree/main/src/scaffoldmaker/meshtypes
I suggest starting with one of the simpler mesh types:
https://github.com/ABI-Software/scaffoldmaker/blob/main/src/scaffoldmaker/meshtypes/meshtype_3d_box1.py
The scripts are coded to create finite element fields, groups and other structures using the Zinc library. You can look up the Zinc API at:
http://opencmiss.org/documentation/apidoc/zinc/latest/classes.html
Note: The C++ API as documented here has some minor changes in Python, mainly in passing arrays (as lists) in and out - use the python samples as a guide.
New scaffolds need to be added here:
https://github.com/ABI-Software/scaffoldmaker/blob/main/src/scaffoldmaker/scaffolds.py
Note that as the Zinc API is quite low level for setting up element parameter maps, we have created some convenience functions for remapping from the default Hermite parameters. These are in:
https://github.com/ABI-Software/scaffoldmaker/blob/main/src/scaffoldmaker/utils/eft_utils.py

@rchristie
Copy link
Member

I'm not sure what you mean by creating new scaffolds from micro CT. Scaffoldmaker (MeshGenerator plugin in MAP-Client) is all about programmatically creating annotated structured anatomical scaffolds. These are created with mathematically generated coordinates. We use another tool Scaffoldfitter (GeometricFit plugin in MAP-client) to fit scaffolds to appropriately annotated digitised data.

@DippedPretzels
Copy link
Author

Thanks - I'll read and look at the examples here. I misunderstood how the generic scaffolds are originally created. I assumed for complex shapes, like the stomach, they were generated by segmented uCT data, from this talk:
https://youtu.be/EslXGWQLlXw?t=336
but I see now that was only for fitting an existing generic scaffold.

I understand a generic scaffold is later used with the separate Scaffoldfitter fitter tool - I but I am confused how the generic organ scaffolds are originally generated. For example, under section 8, from this paper: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8265045/

"Since ICNs are mainly distributed around the basal part of the heart and pulmonary veins, a “generic” scaffold was algorithmically generated from a set of anatomical and mathematical parameters for the atrial topology using the Scaffold-Maker software."

The Meshgenerator plugin seems (to me) to be a gui for modifying existing scaffolds, then exporting them. Looking to the definition of a stomach:
https://github.com/ABI-Software/scaffoldmaker/blob/main/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py
it's quite complex - but I'm also at a loss as to how the positions of nodes that define the topology of the scaffold were first decided upon. Thanks!

@rchristie
Copy link
Member

rchristie commented Mar 14, 2022

The Scaffold Creator (formerly Mesh Generator) plugin provides the UI for scaffoldmaker which makes the scaffolds. The scripts in scaffoldmaker create nodes and elements, defining their coordinates fields, and often more.

@rchristie
Copy link
Member

Closing as not leading to a clear development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants