Skip to content

Commit

Permalink
updated for pyto wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
amineuron committed Oct 25, 2024
1 parent 12f13e7 commit 364ad11
Showing 1 changed file with 40 additions and 33 deletions.
73 changes: 40 additions & 33 deletions notebooks/single_dataset_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


# Set environment variables
# os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

import cryovesnet

Expand All @@ -21,39 +21,46 @@


pl2 = cryovesnet.Pipeline(dataset_directory,pattern='*.rec.nad')
# pl2.setup_cryovesnet_dir(initialize=False, make_masks=True)
# #
# #
pl2.setup_cryovesnet_dir(initialize=False, make_masks=True)
#
# # pl2.run_deep(force_run=True, gauss=True, rescale= None, weight_path=None)
# pl2.run_deep(force_run=True,augmentation_level=4)
# # pl2.run_deep(force_run=True, gauss=False, rescale= None, augmentation_level=4, weight_path=None)
# pl2.rescale(force_run=True, slice_range=None)
# #pl2.rescale(force_run=True,slice_range=[1,130])
#
# pl2.label_vesicles(input_array_name="deep_mask", within_segmentation_region=True,threshold_coef=None)
# # pl2.label_vesicles(input_array_name="deep_mask", within_segmentation_region=False,threshold_coef=0.9)
#
# pl2.label_vesicles_adaptive(expanding = False, convex=False, separating=True)
# df = pl2.make_spheres(tight=True, keep_ellipsoid=False)
# pl2.repair_spheres()
#
#
# #pl2.make_full_modfile(input_array_name='convex_labels')
#
# # pl2.last_output_array_name="convex_labels"
# # pl2.last_output_array_name= "mancorr_labels"
# # pl2.fix_spheres_interactively()
# # pl2.fix_spheres_interactively(max_expected_diameter=45)
# # pl2.fix_spheres_interactively("mancorr_labels")
#
#
# # pl2.last_output_array_name="convex_labels"
# os.system('rm -rf /media/amin/mtwo/84/pyto')
# pl2.make_full_modfile(input_array_name='convex_labels')

# pl2.run_deep(force_run=True, gauss=True, rescale= None, weight_path=None)
# pl2.run_deep(force_run=True,augmentation_level=4)
pl2.run_deep(force_run=True,augmentation_level=1)
# pl2.run_deep(force_run=True, gauss=False, rescale= None, augmentation_level=4, weight_path=None)
pl2.rescale(force_run=True, slice_range=None)
#pl2.rescale(force_run=True,slice_range=[1,130])

pl2.label_vesicles(input_array_name="deep_mask", within_segmentation_region=True,threshold_coef=None)
# pl2.label_vesicles(input_array_name="deep_mask", within_segmentation_region=False,threshold_coef=0.9)

pl2.label_vesicles_adaptive(expanding = False, convex=False, separating=True)
df = pl2.make_spheres(tight=False, keep_ellipsoid=False)
pl2.repair_spheres()


#pl2.make_full_modfile(input_array_name='convex_labels')

### For manual correction ###
pl2.last_output_array_name="convex_labels"
pl2.make_full_label_file()
pl2.pyto_wrapper()
pl2.fix_spheres_interactively(max_expected_diameter=45)


#
### In case you want to continue the manual correction ###
# pl2.last_output_array_name= "mancorr_labels"
# pl2.fix_spheres_interactively()
### or:
# pl2.fix_spheres_interactively("mancorr_labels")


### To clean the old files ###
#os.system('rm -rf /media/amin/mtwo/84/pyto')

## In case u jsut want the automatic segmentation without manual correction
## pl2.last_output_array_name="convex_labels"

### For connector segmentation ###
# pl2.make_full_modfile()
# pl2.make_full_label_file()
# pl2.pyto_wrapper()

0 comments on commit 364ad11

Please sign in to comment.