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

Packaging shapworkspy and use case restructuring #865

Closed
sheryjoe opened this issue Dec 14, 2020 · 14 comments
Closed

Packaging shapworkspy and use case restructuring #865

sheryjoe opened this issue Dec 14, 2020 · 14 comments

Comments

@sheryjoe
Copy link
Contributor

image

@sheryjoe sheryjoe added this to the Deployment & Infrastructure milestone Dec 14, 2020
@sheryjoe sheryjoe changed the title how to package shapworkspy Packaging shapworkspy and use case restructuring Jan 6, 2021
@sheryjoe
Copy link
Contributor Author

sheryjoe commented Jan 6, 2021

From #818

Redesign groom utils so it can be run interactively rather than batch wise.
This will make it so intermediate grooming files don't have to be saved (issue #598) and steps can be skipped (issue #507)

@sheryjoe
Copy link
Contributor Author

sheryjoe commented Jan 6, 2021

Let's use this issue as the parent/driving issue for shapeworks python packaging and associated use case design. We can add more focused issues later and relate them to this one. I have closed related issues accordingly.

@jadie1 @iyerkrithika21 please join G-C slot to discuss this as part of python APIs. Moved this up on the agenda to allow you to leave earlier if needed.

@cchriste
Copy link
Contributor

cchriste commented Jan 6, 2021

I'm looking into Python module packaging now. Please ping me if you have suggestions or thoughts.

Some instructions I've found:

So far I'm most interested in conda for reputedly better dependency specification, but I'd be happy to have anything.
The reason for conda is we should be able to install everything with this package: command line, python module, and studio. But we'll start with our python module.

My biggest fear is multi-platform issues sucking away our lives, so I'll try to get OSX working first and go from there.

@medakk
Copy link
Contributor

medakk commented Jan 13, 2021

The use cases didn't work for me on Ubuntu 18.04, I had to:

  1. in RunUseCase.py, I added at the top sys.path.append('../../build/cmake-build-release/bin/')
  2. set the environment variable LD_LIBRARY_PATH=../../dependencies/install/lib/ (else it complains about a missing "libvcl.so")

@iyerkrithika21
Copy link
Contributor

To have the option of saving intermediate outputs, can we include the write option within each operation rather than a separate write/save function?
What I am imagining is :

img.binarize(write=False)
img.resample(write=True).binarize(write=True)

Instead of

img.binarize()
img.write()
img.resample()
img.write()

@sheryjoe
Copy link
Contributor Author

This will probably need a filename as input argument
e.g., img.binarize(write=True, filename='blabla')

@archanasri @cchriste thoughts?

To have the option of saving intermediate outputs, can we include the write option within each operation rather than a separate write/save function?
What I am imagining is :

img.binarize(write=False)
img.resample(write=True).binarize(write=True)

Instead of

img.binarize()
img.write()
img.resample()
img.write()

@cchriste
Copy link
Contributor

cchriste commented Jan 20, 2021 via email

@iyerkrithika21
Copy link
Contributor

iyerkrithika21 commented Jan 25, 2021

Image.write is chainable like everything else. Just put it in the chain if you want it. img.binarize().write(<path>) img.resample().write(<path>).binarize()

I understand that the write function is also chainable; my point with suggesting a write option within each operation was to have just one function and pass the flag whether we want to save the intermediate images or no and simplify the use cases.
Example sudo-code:

function groom(write_flag):
    img.binarize(write = write_flag).resize(write = write_flag).crop(write=write_flag)
groom(write_flag = True)
groom(write_flag = False)

This way, we can avoid repeating the same piece of code. Just want to know the feasibility of this idea.

@cchriste
Copy link
Contributor

cchriste commented Jan 25, 2021 via email

@sheryjoe
Copy link
Contributor Author

@iyerkrithika21 @jadie1

I agree with @cchriste. Let's not use chaining unless it is semantically reasonable (for instance, resampling binary images), even for these cases we don't have to write every intermediate output of this resampling (combo) step. Let's make use cases easy-to-follow, self-documented, and easy for users to adapt and customize.

@cchriste
Copy link
Contributor

cchriste commented Jan 25, 2021 via email

@iyerkrithika21
Copy link
Contributor

Steps for restructuring:

  1. Include all the helper functions used in the Jupyter notebooks to the ShapeWorks python module.
  2. Update the notebooks to use the helper functions from the python module.
  3. Rewrite python use cases using the python module and python API commands without using GroomUtils.

@cchriste
Copy link
Contributor

cchriste commented Mar 5, 2021

Remember, we have python_module branch in which this is already started. It hasn't been merged for a minute, but keep us posted if someone tackles this. It's high on my priority list.

@jadie1
Copy link
Contributor

jadie1 commented Jun 9, 2021

Done with PR #1181

@jadie1 jadie1 closed this as completed Jun 9, 2021
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

6 participants