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

ENH: Add trame example application for cleaving mesh #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Apr 14, 2022

This commit adds a trame based application allowing the user to select input files (.nrrd, .vti) and cleave the meshes.

Prerequisites: Build vtkCleaver python module

Two approaches:

  • Build VTKCleaver as a VTK remote module. See instructions

  • Build VTKCleaver as a standalone project against a VTK build tree. See instructions

Screenshots

image

image

Next steps

Trame example

  • Ensure Cleave Mesh button loading state is synced with the UI
  • Allow re-ordering of selected input
  • Report progress
  • Add support for downloading cleaved mesh

VTK build system

  • Finalize merge request VTK MR-8123 (vtkModule: Do not generate files in source tree when building module externally )
  • Address issue VTK 18257(CI: upload SDK on tags and weekly jobs)

VTKCleaver build system & continuous integration (CI)

  • Add GitHub workflow for building & publishing VTKCleaver wheel on PyPI leveraging VTKExternalModule helper project. This depends on VTK build system listed above.

vtkRenderer,
vtkRenderWindow,
vtkRenderWindowInteractor,
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you import vtk as vtkpackage you might want to simply use it rather than using vtkmodules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, we will revisit.

Background

Since I initially thought I add to discover the relevant modules associated with each classes, in the interest of time it was easier to import from vtkpackage, especially considering I was adapting a script written by @aronhelser.

@jourdain
Copy link

Seems pretty cool!

This commit adds a trame based application allowing the user to select
input files (.nrrd, .vti) and cleave the meshes.

Co-authored-by: Aron Helser <[email protected]>
@jcfr jcfr force-pushed the add-trame-example branch from cc66f98 to 94f2fbc Compare April 14, 2022 14:56
Comment on lines +219 to +224
# TODO Add a component allowing to re-order "state.input_file_names"
# Possible approaches:
# - v-simple-table + SortableJS
# See https://codepen.io/mykysyk/pen/qBdBRMB
# - v-chip + draggable
# See https://github.com/vuetifyjs/vuetify/issues/11614 and https://jsfiddle.net/cjrqzkf0/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jourdain I would like the ability to re-order the input. Is there a component that would allow me to do so ?

Something like this where I could drag and drop to re-order:

image

These are two approaches:

Do you have any recommendation ? Should I directly use functionality from pywebvue to include sortable.js ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No specific recommendation and in your code base you can use enable_module to serve some JS files and enable them in vue.js. Let me know if you need help in that JS integration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use enable_module to serve some JS files and enable them in vue.js.

Do you happen to have an example handy ?

Copy link

@jourdain jourdain Apr 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +269 to +270
disabled=("!input_available || cleaver_running",),
loading=("cleaver_running", True),
Copy link
Contributor Author

@jcfr jcfr Apr 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state of the button is not updated, I was not able to "force" the state to be updated on the client.

At the following location (See https://github.com/SCIInstitute/VTKCleaver/pull/3/files#r850536393), I tried to add the following without success ...

state.flush("cleaver_running")

@jourdain Would appreciate any suggestion.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because your server is busy working. You need to make it async and run the C++ exec in a task so you can flush the state before your work is done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I was thinking, I will then apply the approach used in https://github.com/Kitware/trame-mnist/blob/master/trame_mnist/app/engine/main.py by using ProcessPoolExecutor ...

I naively thought updating the state object would be sufficient ...

Would it make sense to have the management of state run in a dedicated process by default?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a tricky decision, but I have been thinking of it and I'm not sure yet on how to properly do it. BTW, you do not need ProcessPoolExecutor. Just a task could be enough.



def cleave_inputs():
state.cleaver_running = True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I updated the cleaver_running state

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

Successfully merging this pull request may close these issues.

2 participants