forked from SCIInstitute/ShapeWorks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request SCIInstitute#1335 from SCIInstitute/just_conda_act…
…ivate Add activate/deactivate scripts to conda so executables are available when ShapeWorks is installed
- Loading branch information
Showing
28 changed files
with
417 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
setlocal EnableDelayedExpansion | ||
|
||
:: format windows path into posix path | ||
set BIN_PATH=%cd%\bin | ||
set BIN_PATH=%BIN_PATH:\=/% | ||
set BIN_PATH=/%BIN_PATH::=% | ||
|
||
:: Copy the [de]activate scripts to %PREFIX%\etc\conda\[de]activate.d. | ||
:: This will allow them to be run on environment activation. | ||
for %%F in (activate deactivate) DO ( | ||
if not exist "%CONDA_PREFIX%\etc\conda\%%F.d" mkdir "%CONDA_PREFIX%\etc\conda\%%F.d" | ||
copy .\Installation\shapeworks-%%F.bat "%CONDA_PREFIX%\etc\conda\%%F.d\shapeworks-%%F.bat" | ||
call python .\Installation\replace_strings.py "%CONDA_PREFIX%\etc\conda\%%F.d\shapeworks-%%F.bat" shapeworks_placeholder_string "%cd%\bin" | ||
|
||
:: Copy unix shell activation scripts, needed by Windows Bash users | ||
copy .\Installation\shapeworks-%%F.sh "%CONDA_PREFIX%\etc\conda\%%F.d\shapeworks-%%F.sh" | ||
call python .\Installation\replace_strings.py "%CONDA_PREFIX%\etc\conda\%%F.d\shapeworks-%%F.sh" shapeworks_placeholder_string "\"%BIN_PATH%\"" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -x | ||
|
||
# Copy the [de]activate scripts to $CONDA_PREFIX/etc/conda/[de]activate.d. | ||
# This will allow them to be run on environment activation. | ||
for CHANGE in "activate" "deactivate" | ||
do | ||
mkdir -p "${CONDA_PREFIX}/etc/conda/${CHANGE}.d" | ||
cp "./Installation/shapeworks-${CHANGE}.sh" "${CONDA_PREFIX}/etc/conda/${CHANGE}.d/shapeworks-${CHANGE}.sh" | ||
python ./Installation/replace_strings.py "${CONDA_PREFIX}/etc/conda/${CHANGE}.d/shapeworks-${CHANGE}.sh" shapeworks_placeholder_string "\"`pwd`/bin\"" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import sys | ||
import fileinput | ||
|
||
""" | ||
Replaces strings in a file. | ||
""" | ||
def replace_strings(file, search_exp, replace_exp): | ||
for line in fileinput.input(file, backup='', inplace=1): | ||
if search_exp in line: | ||
line = line.replace(search_exp, replace_exp) | ||
sys.stdout.write(line) | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv[1:]) != 3: | ||
print(f'params: <file> <search string> <replace string>') | ||
sys.exit(1) | ||
FILE = sys.argv[1] | ||
FIND = sys.argv[2] | ||
REPL = sys.argv[3] | ||
replace_strings(FILE, FIND, REPL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@echo off | ||
|
||
REM Store _SHAPEWORKS_BIN_PATH to be removed on conda deactivate. | ||
set _SHAPEWORKS_BIN_PATH=shapeworks_placeholder_string | ||
|
||
REM Add _SHAPEWORKS_BIN_PATH to PATH on conda activate. | ||
set PATH=%_SHAPEWORKS_BIN_PATH%;%PATH% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Store _SHAPEWORKS_BIN_PATH to be removed on conda deactivate. | ||
export _SHAPEWORKS_BIN_PATH=shapeworks_placeholder_string | ||
|
||
# Add _SHAPEWORKS_BIN_PATH to PATH on conda activate. | ||
export PATH=$_SHAPEWORKS_BIN_PATH:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@echo off | ||
setlocal EnableDelayedExpansion | ||
|
||
REM Restore original PATH on conda deactivate. | ||
if defined _SHAPEWORKS_BIN_PATH ( | ||
set PATH=!PATH:%_SHAPEWORKS_BIN_PATH%;=! | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# Restore original PATH on conda deactivate. | ||
if [[ -z "$_SHAPEWORKS_BIN_PATH" ]]; then | ||
export PATH=`echo $PATH | sed "s*$_SHAPEWORKS_BIN_PATH:**g"` | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
def setup_binary_path(): | ||
import sys | ||
sys.path.append("") | ||
sys.path.append("placeholder_string") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,72 @@ | ||
========================================== | ||
ShapeWorks v6.1.0 - Released June 2021 | ||
========================================== | ||
|
||
The ShapeWorks software is an open-source distribution of a new method for | ||
constructing compact statistical point-based models of ensembles of similar | ||
shapes that does not rely on any specific surface parameterization. The method | ||
requires very little preprocessing or parameter tuning and applies to a wide | ||
range of shape analysis problems, including nonmanifold surfaces and objects of | ||
arbitrary topology. The proposed correspondence point optimization uses an | ||
entropy-based minimization that balances the simplicity of the model | ||
(compactness) with the accuracy of the surface representations. The ShapeWorks | ||
software includes tools for preprocessing data, computing point-based shape | ||
models, and visualizing the results. | ||
|
||
===================== | ||
Shapeworks | ||
===================== | ||
|
||
The ShapeWorks software is an open-source distribution of a new method for constructing compact statistical point-based models of ensembles of similar shapes that does not rely on any specific surface parameterization. The method requires very little preprocessing or parameter tuning and applies to a wide range of shape analysis problems, including nonmanifold surfaces and objects of arbitrary topology. The proposed correspondence point optimization uses an entropy-based | ||
minimization that balances the simplicity of the model (compactness) with the accuracy of the surface representations. The ShapeWorks software includes tools for preprocessing data, computing point-based shape models, and visualizing the results. | ||
You have downloaded a binary distribution of ShapeWorks. | ||
|
||
===================== | ||
### Installation instructions. | ||
|
||
You have downloaded a binary distribution of ShapeWorks. | ||
1. Open a terminal and change directory to the installation path (where you unzipped the downloaded file). | ||
`cd /path/to/shapeworks` | ||
|
||
2. Create a protected conda environment that installs everything necessary to run. | ||
`source install_shapeworks.sh` | ||
|
||
1. Open a terminal and change directory to the installation path (where you unzipped the downloaded file): `cd /path/to/shapeworks` | ||
**Note:** You can pass a different name for the environment, enabling multiple installations. | ||
`source install_shapeworks.sh shapeworks_61` | ||
|
||
2. Add the path to the shapeworks executables to your PATH: `export PATH=`pwd`/bin:$PATH` | ||
**Important:** Your shapeworks conda environment must always be activated before using ShapeWorks. | ||
|
||
|
||
ShapeWorks comes with Python examples to get you started. To run them: | ||
### ShapeWorks comes with Python examples to get you started. | ||
|
||
1. Open a terminal and change directory to the installation path (where you unzipped the downloaded file): `cd /path/to/shapeworks` | ||
1. Open a terminal and activate the shapeworks conda environment (use the environment name passed to `install_shapeworks` above). | ||
`conda activate shapeworks` | ||
|
||
2. type `source conda_installs.sh` to install necessary Python packages into a protected environment. | ||
2. Copy the Examples folder to another location of your choosing. | ||
`cp -r Examples $HOME/ShapeWorks-Examples` | ||
|
||
3. Copy the Examples folder to another location (ex: `cp -r Examples $HOME/ShapeWorks-Examples`). | ||
3. Change to the Python folder of the Examples directory you copied. | ||
`cd $HOME/ShapeWorks-Examples/Python` | ||
|
||
4. Activate the shapeworks conda environment: `conda activate shapeworks` | ||
4. Run one of the included use cases. To list them all, run: `python RunUseCase.py --help`. | ||
`python RunUseCase.py --use_case ellipsoid_fd` | ||
|
||
5. With the shapeworks conda environment activated, `cd` to your copied Examples\Python location. | ||
|
||
6. Run `python RunUseCase.py --use_case <insert name of use case here>`. To list the use cases that are currently released, run: `python RunUseCase.py --help`. | ||
### ShapeWorks also includes interactive Jupyter Python notebook examples. | ||
|
||
**Note:** For subsequent usage, the shapeworks conda environment must be activated using `conda activate shapeworks`. | ||
1. Open a terminal and activate the shapeworks conda environment (use the environment name passed to `install_shapeworks` above). | ||
`conda activate shapeworks` | ||
|
||
2. Change to the notebook tutorials folder of the Examples directory you copied. | ||
`cd $HOME/ShapeWorks-Examples/Python/notebooks/tutorials` | ||
|
||
To see the interactive Jupyter notebook examples: | ||
3. Start the Jupyter notebook server. This will open a new tab in your web brower. | ||
`jupyter notebook` | ||
|
||
1. Open a terminal and change directory to your copied Examples\Python\notebooks\tutorials location. | ||
4. Click on a notebook to get started. | ||
|
||
2. Activate the shapeworks conda environment: `conda activate shapeworks` | ||
|
||
3. Run `jupyter notebook` to open the notebooks in your web brower. Click on a notebook to get started. | ||
===================== | ||
|
||
Please contact us with any questions or ideas. | ||
|
||
Website sciinstitute.github.io/ShapeWorks | ||
Email [email protected] | ||
Discourse shapeworks.discourse.group | ||
Twitter @ShapeWorksSuite | ||
|
||
===================== |
Oops, something went wrong.