Hello,
I am trying to write a python script to automate assigning microtubule protofilament number and direction by comparing an image to a reference and using the ccc score, but it doesn't seem to be performing as well as I would expect. Currently as references I use 2D projections of MT em maps that I have inverted the contrast for, applied a circular mask and made a rotational average with symmetry depending on number of protofilaments (12 pf c12 symmetry).
I have an image stack of rotated and z projected subtomograms so that you are looking down the microtubule. I have high-passed filtered these and applied a circular mask:
z_proj = data.process('misc.directional_sum',{'axis':'z'})
z_proj.process('filter.highpass.gauss', {'cutoff_abs':0.01})
z_proj.process('normalize')
z_proj = z_proj * zmask
The high pass filter seems to help with the translational alignment to the reference.
I then use my check_pf function to compare each image in the stack to a reference image in the reference stack.
def check_pf(stack, references, mask): #stack is a list of z projected subtomos, references is the list of reference microtubules 11-15pf and alternating in direction, mask is the 2D circular mask.
top_classes = []
top_scores = []
for j in range(len(stack)): #iterate through image stack
img = stack[j]
img.process('xform.center') #center MT in image, not sure necessary?
score = []
best=(-2,-1)
for item in range(12):
pf = item+(11-((item+(item%2))/2)) #works out pf number of reference based on position in stack
rotated = img.process('xform.applysym',{'sym':f'c{pf}'}) #apply pf symmetry to image
reference = references[item].process('xform.center') #center reference MT
reference = reference.process('normalize') #normalize
aligned = rotated.align("rotate_translate", reference, {'useflcf':1, 'maxshift':2}) #do you think flcf is better?
c = aligned.cmp("ccc",reference,{"negative":0,"mask":mask}) #cross correlation coefficient of image to reference
best=max(best,(c,item))
score.append(c)
top_score = best[0] #value of top score
top_score_index = best[1]+1 #class top score belongs to
top_classes.append(top_score_index)
top_scores.append(top_score)
to_write = [j, top_score_index, top_score]
writer_h.writerow(to_write) #write image, class, and score to csv file
return top_classes, top_scores
Do you think comparing the rotational averages is better than comparing the raw image?
Do you think the flcf would align these better?
Would you recommend a better or different way of doing this?
Let me know if you need any more info!
Many thanks!
Molly