Schroeder-Lab / Data

For pre-processing raw data (two-photon, ephys, bonsai, ...) and loading/saving data.
0 stars 3 forks source link

function _register_zstack_frames: correction #36

Closed mariacozan closed 1 year ago

mariacozan commented 1 year ago
  1. The final line in the function _register_zstack_frames in process_tiff performs the same computation as the line before it, see here:
def register_zstack_frames(zstack):
    #### Start from centre take triples and align them
    centreFrame = int(np.floor(zstack.shape[0] / 2))
    tempStack = np.zeros_like(zstack)
    # swipe up
    zstack = _register_swipe(zstack, centreFrame, 0, -1)
    # swipe down
    zstack = _register_swipe(zstack, centreFrame, zstack.shape[0], 1)
    # top to bottom
    zstack = _register_swipe(zstack, centreFrame, zstack.shape[0], 1)
    return zstack

The comment before this line suggests this should have been:

def register_zstack_frames(zstack):
    #### Start from centre take triples and align them
    centreFrame = int(np.floor(zstack.shape[0] / 2))
    tempStack = np.zeros_like(zstack)
    # swipe up
    zstack = _register_swipe(zstack, centreFrame, 0, -1)
    # swipe down
    zstack = _register_swipe(zstack, centreFrame, zstack.shape[0], 1)
    # top to bottom
    zstack = _register_swipe(zstack, 0, zstack.shape[0], 1)
    return zstack

2. I have a question regarding this: what is the purpose of doing this registration in these three steps?

  1. There is an unused variable (tempStack) in the function which should be removed.
liadJB commented 1 year ago

1) corrected it to be as intended. Shows how great it is to sometimes write comments 2) since it's a stack the frames from top to bottom are different from each other, the similarities are between neighbouring frames. Thus to register it one needs to register the frames step-wise. I found that the best way is make sure one half is registered than the other and then when it's properly registered