@@ -68,8 +68,8 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
6868 #@ UIService ui
6969 #@ ImgPlus img
7070 #@ String (visibility = MESSAGE, value = "<b>Channel settings</b>", required = false) ch_msg
71- #@ String (label = "Channel A name", value = "a ") ch_a_name
72- #@ String (label = "Channel B name", value = "b ") ch_b_name
71+ #@ String (label = "Channel A name", value = "Vif ") ch_a_name
72+ #@ String (label = "Channel B name", value = "Nuclei ") ch_b_name
7373 #@ Integer (label = "Channel A position", value = 1) ch_a
7474 #@ Integer (label = "Channel B position", value = 2) ch_b
7575 #@ String (visibility = MESSAGE, value = "<b>Image calibration</b>", required = false) cal_msg
@@ -86,8 +86,6 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
8686
8787 from org.scijava.table import DefaultGenericTable
8888
89- from jarray import array
90-
9189
9290 def extract_channel(image, ch):
9391 """Extract a channel from the input image.
@@ -108,7 +106,6 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
108106 """
109107 # find C and Z axis indicies
110108 c_idx = find_axis_index(image, "Channel")
111- z_idx = find_axis_index(image, "Z")
112109
113110 return ops.op("transform.hyperSliceView").input(image, c_idx, ch - 1).apply()
114111
@@ -208,7 +205,6 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
208205 ch_b_ths= ops.op("create.img").input(ch_b_img, BitType()).apply()
209206 ops.op("threshold.otsu").input(ch_b_img).output(ch_b_ths).compute()
210207 ch_b_mask = ops.op("morphology.open").input(ch_b_ths, HyperSphereShape(2), 4).apply()
211- ch_b_mask = ops.op("morphology.fillHoles").input(ch_b_mask, HyperSphereShape(2)).apply()
212208
213209 # extract mask "A" data from mask "B" region
214210 ch_ab_mask = extract_inside_mask(ch_a_mask, ch_b_mask)
@@ -217,7 +213,7 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
217213 ab_labeling = ops.op("labeling.cca").input(ch_ab_mask, StructuringElement.EIGHT_CONNECTED).apply()
218214 b_labeling = ops.op("labeling.cca").input(ch_b_mask, StructuringElement.EIGHT_CONNECTED).apply()
219215
220- # create a table and make measurement
216+ # create a table for the "AB" mask and make mesurements
221217 ab_table = DefaultGenericTable(3, 0)
222218 ab_table.setColumnHeader(0, "{} size (pixels)".format(ch_a_name))
223219 ab_table.setColumnHeader(1, "{} volume (um^3)".format(ch_a_name))
@@ -235,11 +231,12 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
235231 ).apply()
236232 mesh = ops.op("geom.marchingCubes").input(crop).apply()
237233 ab_table.appendRow()
234+ # measure mesh/sample geometry and stats
238235 ab_table.set("{} size (pixels)".format(ch_a_name), i, ops.op("stats.size").input(sample).apply())
239236 ab_table.set("{} volume (um^3)".format(ch_a_name), i, ops.op("geom.size").input(mesh).apply().getRealFloat() * (x_cal * y_cal * z_cal))
240237 ab_table.set("{} sphericity".format(ch_a_name), i, ops.op("geom.sphericity").input(mesh).apply())
241238 i += 1
242-
239+ # create a table for the "B" mask and make measurements
243240 b_table = DefaultGenericTable(3, 0)
244241 b_table.setColumnHeader(0, "{} size (pixels)".format(ch_b_name))
245242 b_table.setColumnHeader(1, "{} volume (um^3)".format(ch_b_name))
@@ -257,12 +254,13 @@ and a pixel width and height of 0.0650 μm with a step size of 0.1 μm (see the
257254 ).apply()
258255 mesh = ops.op("geom.marchingCubes").input(crop).apply()
259256 b_table.appendRow()
257+ # measure mesh/sample geometry and stats
260258 b_table.set("{} size (pixels)".format(ch_b_name), j, ops.op("stats.size").input(sample).apply())
261259 b_table.set("{} volume (um^3)".format(ch_b_name), j, ops.op("geom.size").input(mesh).apply().getRealFloat() * (x_cal * y_cal * z_cal))
262260 b_table.set("{} sphericity".format(ch_b_name), j, ops.op("geom.sphericity").input(mesh).apply())
263261 j += 1
264262
265- # display table and labeling
263+ # display results tables and labeling image
266264 ui.show(ab_labeling.getIndexImg())
267265 ui.show("{} results table".format(ch_a_name), ab_table)
268266 ui.show("{} results table".format(ch_b_name), b_table)
0 commit comments