File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from ai .nets .samj .ij import SAMJ_Annotator
33
44from java .util import ArrayList
5+
56from time import time
67
78from ij import IJ
8-
9+ from jarray import array
910from net .imglib2 .img .display .imagej import ImageJFunctions
1011
1112
1516model = SAM2Tiny ()
1617
1718point_prompt = ArrayList ()
18- point_prompt .add ((100 , 100 ))
1919
20- start_time = time ()
2120
22- mask = SAMJ_Annotator .samJReturnMask (model , wrapImg , point_prompt , None )
21+ my_seq = (100 , 100 )
22+
23+ arr1 = array (my_seq ,'i' )
2324
25+
26+ point_prompt .add (arr1 )
27+
28+ start_time = time ()
29+ mask = SAMJ_Annotator .samJReturnMask (model , wrapImg , point_prompt , None )
2430end_time = time ()
2531
2632mask_sum = 0
2733cursor = mask .cursor ()
2834
2935while cursor .hasNext ():
30- mask_sum += cursor .get ()
31- cursor .next ()
36+ cursor .next ()
37+ mask_sum += cursor .get (). getRealDouble ()
3238
3339print ("Total non-zero pixels: " + str (mask_sum ))
3440print ("Total time: " + str (end_time - start_time ))
You can’t perform that action at this time.
0 commit comments