Skip to content
Snippets Groups Projects
Commit 06c407b9 authored by Laurent Guerard's avatar Laurent Guerard
Browse files

Format code

parent d112f2ec
No related branches found
No related tags found
No related merge requests found
......@@ -318,7 +318,6 @@ def run_tm(
settings.trackerSettings["GAP_CLOSING_MAX_DISTANCE"] = 3.0
settings.trackerSettings["MAX_FRAME_GAP"] = 2
# Initialize TrackMate with model and settings
trackmate = TrackMate(model, settings)
trackmate.computeSpotFeatures(True)
......@@ -578,7 +577,7 @@ def add_results(rt, column, row, value):
value : string or float or integer
the value to be set
"""
for i in range( len( row ) ):
for i in range(len(row)):
rt.setValue(column, row[i], value)
rt.show("Results")
......@@ -621,7 +620,7 @@ def setup_defined_ij(rm, rt):
a reference of the IJ-ResultsTable
"""
fix_ij_options()
rm.runCommand('reset')
rm.runCommand("reset")
rt.reset()
IJ.log("\\Clear")
......@@ -633,57 +632,12 @@ if __name__ == "__main__":
IJ.log("\\Clear")
misc.timed_log("Script starting")
setup_defined_ij(rm, rt)
path_to_image = fix_ij_dirs(path_to_image)
raw = open_image_with_BF(path_to_image)
# get image info
raw_image_calibration = raw.getCalibration()
raw_image_title = fix_BF_czi_imagetitle(raw)
print("raw image title: ", str(raw_image_title))
# take care of paths and directories
output_dir = fix_ij_dirs(output_dir) + "/" + str(raw_image_title) + "/1_identify_fibers"
print("output_dir: ", str(output_dir))
if not os.path.exists( str(output_dir) ):
os.makedirs( str(output_dir) )
# update the log for the user
IJ.log( "Now working on " + str(raw_image_title) )
if raw_image_calibration.scaled() == False:
IJ.log("Your image is not spatially calibrated! Size measurements are only possible in [px].")
IJ.log( " -- settings used -- ")
IJ.log( "area = " + str(minAr) + "-" + str(maxAr) )
IJ.log( "perimeter = " + str(minPer) + "-" + str(maxPer) )
IJ.log( "circularity = " + str(minCir) + "-" + str(maxCir) )
IJ.log( "roundness = " + str(minRnd) + "-" + str(maxRnd) )
IJ.log( "solidity = " + str(minSol) + "-" + str(maxSol) )
IJ.log( "feret_ar = " + str(minFAR) + "-" + str(maxFAR) )
IJ.log( "min_feret = " + str(minMinFer) + "-" + str(maxMinFer) )
IJ.log( "ROI expansion [microns] = " + str(enlarge) )
IJ.log( "Membrane channel = " + str(membrane_channel) )
IJ.log( "MHC positive fiber channel = " + str(fiber_channel) )
IJ.log( "sub-tiling = " + str(tiling_factor) )
IJ.log( " -- settings used -- ")
# image (pre)processing and segmentation (-> ROIs)# imp, firstC, lastC, firstZ,
# lastZ, firstT, lastT
membrane = Duplicator().run(raw, membrane_channel, membrane_channel, 1, 1, 1, 1)
preprocess_membrane_channel(membrane)
imp_result = run_tm(membrane, 1, cellpose_dir.getPath(), PretrainedModel.CYTO2, 30.0, area_thresh=[minAr, maxAr], circularity_thresh=[minCir, maxCir],
perimeter_thresh=[minPer, maxPer],
# feret_thresh=[minMinFer, maxMinFer],
)
IJ.saveAs(imp_result, "Tiff", output_dir + "/" + raw_image_title + "_all_fibers_binary")
sys.exit()
file_list = pathtools.listdir_matching(
src_dir.getPath(), filename_filter, fullpath=True
)
out_dir_info = pathtools.parse_path(output_dir)
rm.hide()
raw.hide()
for index, file in enumerate(file_list):
# open image using Bio-Formats
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment