Exemplo n.º 1
0
    def open_file(self):

        self.cframe = 0
        
        folder = QtWidgets.QFileDialog.getExistingDirectory(self,\
                                    "Choose datafolder",
                                    FOLDERS[self.folderB.currentText()])
        # folder = '/home/yann/DATA/14-10-48/'

        if folder!='':
            
            self.datafolder = folder
            
            if os.path.isdir(os.path.join(folder, 'FaceCamera-imgs')):
                
                self.reset()
                self.imgfolder = os.path.join(self.datafolder, 'FaceCamera-imgs')
                process.load_folder(self) # in init: self.times, _, self.nframes, ...
                
            else:
                self.times, self.imgfolder, self.nframes, self.FILES = None, None, None, None
                print(' /!\ no raw FaceCamera data found ...')

            if os.path.isfile(os.path.join(self.datafolder, 'facemotion.npy')):
                
                self.data = np.load(os.path.join(self.datafolder, 'facemotion.npy'),
                                    allow_pickle=True).item()
                
                if (self.nframes is None) and ('frame' in self.data):
                    self.nframes = self.data['frame'].max()

                if 'ROI' in self.data:
                    self.ROI = roi.faceROI(moveable=True, parent=self,
                                           pos=self.data['ROI'])
                    

                if 'ROIsaturation' in self.data:
                    self.sl.setValue(int(self.data['ROIsaturation']))

                if 'grooming_threshold' in self.data:
                    self.grooming_threshold = self.data['grooming_threshold']
                else:
                    self.grooming_threshold = int(self.data['motion'].max())+1
                    
                self.groomingBox.setText(str(self.grooming_threshold))
                    
                if 'frame' in self.data:
                    self.plot_motion_trace()
                
            else:
                self.data = None

            if self.times is not None:
                self.jump_to_frame()
                self.timeLabel.setEnabled(True)
                self.frameSlider.setEnabled(True)
                self.movieLabel.setText(folder)
Exemplo n.º 2
0
    def load_last_gui_settings(self):

        try:
            settings = np.load(os.path.join(pathlib.Path(__file__).resolve().parent, '_gui_settings.npy'),
                               allow_pickle=True).item()

            self.ROI = roi.faceROI(moveable=True, parent=self,
                                   pos=settings['ROI'])
            self.groomingBox.setText(str(int(settings['grooming_threshold'])))
        except FileNotFoundError:
            print('\n /!\ last GUI settings not found ... \n')
Exemplo n.º 3
0
 def add_ROI(self):
     self.ROI = roi.faceROI(moveable=True, parent=self)