Skip to content

Commit

Permalink
Merge pull request #2019 from SCIInstitute/2017-windows-python
Browse files Browse the repository at this point in the history
2017 windows python
  • Loading branch information
akenmorris committed Mar 22, 2023
2 parents 6858231 + 04fb943 commit f7a5020
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 34 deletions.
6 changes: 3 additions & 3 deletions Examples/Python/deep_ssm.py
Expand Up @@ -249,7 +249,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimizeCmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimizeCmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimizeCmd)

print("To analyze train shape model, call:")
Expand Down Expand Up @@ -533,7 +533,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

print("To analyze validation shape model, call:")
Expand Down Expand Up @@ -690,4 +690,4 @@ def check_results(args, mean_dist):
print("Done with test, verification succeeded.")
exit(0)
else:
return
return
2 changes: 1 addition & 1 deletion Examples/Python/ellipsoid.py
Expand Up @@ -206,7 +206,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/ellipsoid_cut.py
Expand Up @@ -169,7 +169,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/ellipsoid_fd.py
Expand Up @@ -185,7 +185,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/ellipsoid_mesh.py
Expand Up @@ -173,7 +173,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/ellipsoid_multiple_domain.py
Expand Up @@ -271,7 +271,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/ellipsoid_multiple_domain_mesh.py
Expand Up @@ -204,7 +204,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/femur_cut.py
Expand Up @@ -225,7 +225,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimizeCmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimizeCmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimizeCmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/hip_multiple_domain.py
Expand Up @@ -248,7 +248,7 @@ def Run_Pipeline(args):


# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# # If tiny test or verify, check results and exit
Expand Down
4 changes: 2 additions & 2 deletions Examples/Python/incremental_supershapes.py
Expand Up @@ -198,7 +198,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
print(optimize_cmd)
subprocess.check_call(optimize_cmd)

Expand Down Expand Up @@ -284,7 +284,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' +
optimize_cmd = ('shapeworks optimize --progress --name ' +
spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

Expand Down
5 changes: 3 additions & 2 deletions Examples/Python/left_atrium.py
Expand Up @@ -208,7 +208,7 @@ def Run_Pipeline(args):
parameter_dictionary["multiscale"] = 1
parameter_dictionary["multiscale_particles"] = 128

print('Generating project sheet')
print('Generating project file')
# Add param dictionary to spreadsheet
for key in parameter_dictionary:
parameters.set(key, sw.Variant([parameter_dictionary[key]]))
Expand All @@ -217,7 +217,8 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
print('Running optimization')
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/lumps.py
Expand Up @@ -127,7 +127,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/peanut_shared_boundary.py
Expand Up @@ -218,7 +218,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/supershapes_1mode_contour.py
Expand Up @@ -99,7 +99,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/thin_cavity_bean.py
Expand Up @@ -123,7 +123,7 @@ def Run_Pipeline(args):
project.save(spreadsheet_file)

# Run optimization
optimize_cmd = ('shapeworks optimize --name ' + spreadsheet_file).split()
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
2 changes: 1 addition & 1 deletion Installation/install_python_module.bat
Expand Up @@ -2,7 +2,7 @@ REM Installs the shapeworks python module.
REM NOTE: assumes all library dependencies are in this directory\bin

REM install pip module
call pip install Python\shapeworks
call pip install Python\shapeworks.tar.gz

set CONDA_INSTALL_DIR=%CONDA_PREFIX%\lib\site-packages\shapeworks

Expand Down
4 changes: 3 additions & 1 deletion Libs/Optimize/Optimize.cpp
Expand Up @@ -2204,7 +2204,9 @@ void Optimize::ComputeTotalIterations() {
void Optimize::UpdateProgress() {
auto now = std::chrono::system_clock::now();

if ((now - m_last_update_time) > std::chrono::milliseconds(100)) {
bool final = current_particle_iterations_ == total_particle_iterations_;

if (final || (now - m_last_update_time) > std::chrono::milliseconds(100)) {
m_last_update_time = now;
std::chrono::duration<double> elapsed_seconds =
std::chrono::duration_cast<std::chrono::seconds>(now - m_start_time);
Expand Down
13 changes: 6 additions & 7 deletions Support/package_windows.sh
Expand Up @@ -43,13 +43,12 @@ cp -r $BUILD/bin/Release bin
rm bin/*Tests.pdb bin/Recon*.pdb bin/Mesh*.pdb
rm -rf Post

# Run auto-documentation
cd $ROOT
PATH=$BUILD/bin/Release/bin:$PATH

# add $PATH to $PYTHONPATH
PYTHONPATH=$PYTHONPATH:$PATH

# Build python packages
for package in DataAugmentationUtilsPackage DatasetUtilsPackage DeepSSMUtilsPackage DocumentationUtilsPackage ShapeCohortGenPackage shapeworks ; do
cd Python
tar czvf ${package}.tar.gz $package
cd ..
done

# Remove tests, they won't work for users anyway
rm bin/*Tests.exe
Expand Down
16 changes: 10 additions & 6 deletions install_shapeworks.bat
Expand Up @@ -11,7 +11,7 @@ call conda config --add channels anaconda
call conda config --add channels conda-forge

REM install shapeworks deps
call conda create --yes --name %CONDAENV% python=3.9.13 openblas=0.3.20 'vtk=9.1.0=qt*' scikit-learn=1.1.1 pip=22.1.2
call conda create --yes --name %CONDAENV% python=3.9.13 'vtk=9.1.0=qt*' pip=22.1.2
call conda activate %CONDAENV%

REM reactivate shapeworks environment
Expand All @@ -38,12 +38,16 @@ call pip install itk-elastix==0.13.0
call pip install SimpleITK==2.1.1.2
call pip install bokeh==2.4.3
call pip install seaborn==0.11.2
call pip install scikit-learn==1.1.1
call pip install pyvista==0.34.1

call pip install Python/DatasetUtilsPackage
call pip install Python/DocumentationUtilsPackage
call pip install Python/DataAugmentationUtilsPackage
call pip install Python/DeepSSMUtilsPackage
call pip install Python/ShapeCohortGenPackage
call pip install swcc==1.0.3

call pip install Python/DatasetUtilsPackage.tar.gz
call pip install Python/DocumentationUtilsPackage.tar.gz
call pip install Python/DataAugmentationUtilsPackage.tar.gz
call pip install Python/DeepSSMUtilsPackage.tar.gz
call pip install Python/ShapeCohortGenPackage.tar.gz

REM install the shapeworks python module and conda [de]activate scripts
call .\Installation\install_python_module.bat
Expand Down

0 comments on commit f7a5020

Please sign in to comment.