Skip to content

Commit

Permalink
Minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
landang14 committed May 13, 2024
1 parent 9823931 commit 1b48ecf
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions programs/e2tomo_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,32 @@ def __init__(self, application,options,data=None,annotate=None):
self.tomogram_list = QtWidgets.QListWidget()
self.tom_file_list = []
self.seg_grps = []

self.tomo_tree = QtWidgets.QTreeWidget()

if len(self.tom_folder)>0:
if len(options.tomo)>0:
self.tom_folder = "."
tom_ls = options.tomo.split(',')
for file_name in tom_ls:
if file_name.endswith(".hdf"):
self.tom_file_list.append(file_name)
else:
print(file_name,"is not a valid file_name. Pass")
continue

elif len(self.tom_folder)>0:
tom_ls = sorted(os.listdir(self.tom_folder))
# seg_ls = sorted(os.listdir(self.seg_folder))
for file_name in tom_ls:
if file_name.endswith(".hdf"):
self.tom_file_list.append(file_name)

elif len(options.tomo) == 0:
else:
print("Specify tomogram or tomograms folder for start annotation")
sys.exit(0)
return

else:
tom_ls = options.tomo.split(',')
for file_name in tom_ls:
if file_name.endswith(".hdf"):
self.tom_file_list.append(file_name)
else:
print(file_name,"is not a valid file_name. Pass")


print("Self.tom_file_list",self.tom_file_list)
#print("Self.tom_file_list",self.tom_file_list)
for t in range(len(self.tom_file_list)):
file_name = self.tom_file_list[t]
#Populate the Tree
Expand Down Expand Up @@ -3042,6 +3043,7 @@ def __init__(self,target):
#self.extract_train_le = QtWidgets.QLineEdit()
#self.extract_train_le.setText(os.path.join('./trainset/',base_name(self.target.data_file)[0:-4]+"_trainset.hdf"))

#ox,oy,oz = self.target.cur_region.get_origin()
if "boxes_3d" in info:
box=info["boxes_3d"]

Expand All @@ -3054,6 +3056,12 @@ def __init__(self,target):
#### X-center,Y-center,Z-center,method,[score,[class #]]
bdf=[0,0,0,"manual",0.0, 0, 0]
for j,bi in enumerate(b): bdf[j]=bi

# bdf[0] = bdf[0] - ox
# bdf[1] = bdf[1] - oy
# bdf[2] = bdf[2] - oz


if bdf[5] not in list(self.sets.keys()):
clsi=int(bdf[5])
self.sets[clsi]="particles_{:02d}".format(clsi)
Expand Down Expand Up @@ -4130,6 +4138,7 @@ def do_match(jsd, xfs):
for xf in xfs:
r=ref.process("xform", {"transform":xf})
r.clip_inplace(tomo_reg)
#r.process_inplace("mask.fft.wedge",{"anglemax":30,"anglemin":-30})
f_ref = r.do_fft()
cf=f_tomo.calc_ccf(f_ref)
jsd.put(cf)
Expand Down Expand Up @@ -5115,7 +5124,6 @@ def detect_plane(self):
print(a/np.pi*180)

alt = angles[1]/np.pi*180
#print("ALT", alt)
self.target.get_inspector().alts.setValue(alt)
self.target.get_inspector().ns.setValue(0)
self.target.img_view.del_shape("p1")
Expand Down

0 comments on commit 1b48ecf

Please sign in to comment.