Beispiel #1
0
 def motor_position_at_zero(self):
     """ Motor position (x, y and z in microns) corresponding to the scan's (0, 0, 0)
     point. For non-multiroi scans, (x=0, y=0) marks the center of the FOV."""
     match = re.search(r'hMotors\.motorPosition = (?P<motor_position>.*)',
                       self.header)
     motor_position = matlabstr2py(
         match.group('motor_position'))[:3] if match else None
     return motor_position
Beispiel #2
0
 def requested_scanning_depths(self):
     match = re.search(r'hStackManager\.zs = (?P<zs>.*)', self.header)
     if match:
         zs = matlabstr2py(match.group('zs'))
         scanning_depths = zs if isinstance(zs, list) else [zs]
     else:
         scanning_depths = None
     return scanning_depths
Beispiel #3
0
 def num_channels(self):
     match = re.search(r'hChannels\.channelSave = (?P<channels>.*)',
                       self.header)
     if match:
         channels = matlabstr2py(match.group('channels'))
         num_channels = len(channels) if isinstance(channels, list) else 1
     else:
         num_channels = None
     return num_channels
Beispiel #4
0
 def image_width_in_microns(self):
     match = re.search(r'hRoiManager\.imagingFovUm = (?P<fov_corners>.*)',
                       self.header)
     if match:
         fov_corners = matlabstr2py(match.group('fov_corners'))
         image_width_in_microns = fov_corners[1][0] - fov_corners[0][
             0]  # x1-x0
     else:
         image_width_in_microns = None
     return image_width_in_microns
Beispiel #5
0
 def initial_secondary_z(self):
     """ Initial position in z (microns) of the secondary motor (if any)."""
     match = re.search(r'hMotors\.motorPosition = (?P<motor_position>.*)',
                       self.header)
     if match:
         motor_position = matlabstr2py(match.group('motor_position'))
         secondary_z = motor_position[3] if len(
             motor_position) > 3 else None
     else:
         secondary_z = None
     return secondary_z
Beispiel #6
0
    def MINI2P_scope(self):
        '''
        MINI 2P scope name
        '''
        match = re.search(r'SI.*.MINI2P_scope\s*?=\s*?(?P<scope>.*)',
                          self.header)

        if match:
            mini2p_scope = matlabstr2py(match.group('scope').strip())
            return mini2p_scope
        else:
            return None
Beispiel #7
0
    def MINI2P_objective(self):
        '''
        MINI 2P objective name
        '''
        match = re.search(r'SI.*.MINI2P_objective\s*?=\s*?(?P<obj>.*)',
                          self.header)

        if match:
            mini2p_objective = matlabstr2py(match.group('obj').strip())
            return mini2p_objective
        else:
            return None
Beispiel #8
0
    def MINI2P_system(self):
        '''
        MINI 2P setup (system) name
        '''
        match = re.search(r'SI.*.MINI2P_system\s*?=\s*?(?P<system>.*)',
                          self.header)

        if match:
            mini2p_system = matlabstr2py(match.group('system').strip())
            return mini2p_system
        else:
            return None
Beispiel #9
0
 def MINI2P_transform_matrix_path(self):
     ''' 
     Path of transform matrix object (.mat file)
     that was used for unwarping (correcting) raw scanimage data
     SI.Custom.MINI2P.tf_path | str | transformMatrixDirectory
     '''
     match = re.search(r'SI.*.tf_path\s*?=\s*?(?P<tf_path>.*)', self.header)
     if match:
         path = matlabstr2py(match.group('tf_path').strip())
         return path
     else:
         return None
Beispiel #10
0
 def requested_scanning_depths_relative(self):
     match = re.search(r'hStackManager\.zsRelative = (?P<zs_relative>.*)',
                       self.header)
     if match:
         zs = matlabstr2py(match.group('zs_relative'))
         if isinstance(zs, list):
             scanning_depths_relative = [z[0] for z in zs]
         else:
             scanning_depths_relative = [zs]
     else:
         scanning_depths_relative = None
     return scanning_depths_relative
Beispiel #11
0
    def MINI2P_corrected(self):
        ''' 
        Was MINI2P unwarping applied to the data?
        SI.Custom.MINI2P.MINI2P_Corrected | 'true' or '1' 
        '''
        match = re.search(r'SI.*.MINI2P_Corrected\s*?=\s*?(?P<corrected>.*)',
                          self.header)

        if match:
            corrected = matlabstr2py(match.group('corrected').strip())
            return corrected in [1, True]
        else:
            return False
Beispiel #12
0
    def MINI2P_transform_matrix_index(self):
        ''' 
        Returns index in (matlab) transform matrix object 
        (see transform_matrix_path() above)
        that was used to correct the data. 
        WARNING! 1-indexing
        
        '''
        match = re.search(r'SI.*.tfused\s*?=\s*?(?P<tfused>.*)', self.header)

        if match:
            tfused = matlabstr2py(match.group('tfused').strip())
            return int(tfused)
        else:
            return None