def deleteTracker(self, tracker_id=0): # Get the name of the tracker tracker_name = self.tracker_list[tracker_id] # Change the current tracker if self.parent.config.tracker == tracker_name: # Set the selected tracker to Default self.parent.config.tracker = 'Default' # Save the settings to the file self.parent.config.save() # Ask for confirmation if warningProceedMessage( "Delete Tracker?", "Are you sure you want to delete the selected tracker (" + tracker_name + ")?"): # Delete the tracker deleteTracker(tracker_name) # Refresh the display self.fillTrackerTable()
def processStack(self): # Save the current settings in the class self.saveSettings() # Ask the user to save the new settings as well if needed if self.trajectory_session.modified: # Prompt if warningProceedMessage( 'Save Tracker', 'Do you want to save the batch settings of the tracker in the memory?' ): editTrackerConfig(self.trajectory_session) # Retrieve the displayed stack tab_id = self.parent.imageTabDisplay.currentIndex() self.image_class = self.parent.imageTabDisplay.displayedTabs[ tab_id].image_class # Open the progress bar window openWindow(self.parent, TrackpyProgressBarWindow, 'progress_bar', image_class=self.image_class, trackpy_session=self.detection_session, scheduler=self)
def newTracker(self): # Prompt the user for the file name tracker_name, ok = qtw.QInputDialog.getText(self, "Tracker Name", "Name of the new tracker?") if ok: # Raise an error if the 'Default' tracker is selected if tracker_name == 'Default': errorMessage('Forbidden Action',"The settings of the Default tracker cannot be edited.") else: # Check if the name is in the list _write = True trackers_list = listTrackerConfigs() if tracker_name in trackers_list: _write = warningProceedMessage('Existing Tracker','The selected tracker name ('+tracker_name+') is already in the memory. Do you want to replace it?') if _write: # Update the selection self.updateDetectionSession() # Collect the settings self.current_tracker = tracker_name self.trajectory_session.name = tracker_name self.trajectory_session.modified = True # Save the tracker session in file editTrackerConfig(self.trajectory_session)
def closeEvent(self, event=None): # Check if the modification has been saved yet proceed = True if not self.is_saved: proceed = warningProceedMessage( 'Modification not saved', 'The modification on the current path have not been saved yet. Are you sure you want to close?' ) if proceed: event.accept() self.parent.subWindows['paths_editor'] = None else: event.ignore()
def editTracker(self): # Raise an error if the 'Default' tracker is selected if self.current_tracker == 'Default': errorMessage('Forbidden Action',"The settings of the Default tracker cannot be edited.") else: if warningProceedMessage('Overwrite Tracker','Are you sure you want to replace the settings of the tracker '+self.current_tracker+' in the memory?'): # Update the selection self.updateDetectionSession() # Edit the tracker settings self.trajectory_session.modified = True editTrackerConfig(self.trajectory_session)
def correctFluctuations(self): # Get the settings correction_type = self.correctionSelectionBox.currentText().lower() # Check the fluctuations values do_correction = True if self.variations_value < 0.01: do_correction = warningProceedMessage( 'Low intensity fluctuations', 'The measured intensity fluctuations are below 0.01% of the mean intensity. Performing a correction might not improve the quality of the signal. Proceed anyway?' ) # Do the correction if accepted if do_correction: # Open the progress window openWindow(self.parent, ImageCorrectionProgressBarWindow, 'progress_bar') self.image_array = intensityCorrection(self.image_array, correction=correction_type) # Get the current tab tab_id = self.parent.imageTabDisplay.currentIndex() use_name = self.parent.imageTabDisplay.displayedTabs[ tab_id].image_class.name # Load the array in a file new_class = ImageCollection(self.image_array, name=use_name, space_scale=self.parent.space_scale, space_unit=self.parent.space_unit, frame_rate=self.parent.frame_rate) # Refresh the tab self.parent.imageTabDisplay.replaceTab(tab_id, new_class) # Close the progress window self.parent.subWindows['progress_bar'].close() self.parent.application.processEvents() # Close the window self.close()
def createNewPath(self): # Check if the modification has been saved yet proceed = True if not self.is_saved: proceed = warningProceedMessage( 'Modification not saved', 'The modification on the current path have not been saved yet. Are you sure you want to create a new path?' ) if proceed: # Create a new empty dataframe new_path = pd.DataFrame({ 'y': [], 'x': [], 'frame': np.array([]).astype(int), 'particle': np.array([]).astype(int) }) # Reset the variables self.new_position = None self.current_position = None # Drop the position from the dataframe self.current_track = new_path self.current_path = int( len(self.image_class.trajectory.positions['particle'].unique()) ) # Manage the frame refresh crt_frame = self.current_frame self.current_frame = -1 # Change the saved status self.is_saved = False # Refresh the display self.changeFrame(frame_id=crt_frame)
def changePath(self): # Get the path ID path_id = int(self.pathSelectionBox.currentText()) if path_id != self.current_path: # Check if the modification has been saved yet proceed = True if not self.is_saved: proceed = warningProceedMessage( 'Modification not saved', 'The modification on the current path have not been saved yet. Are you sure you want to load a new path?' ) if proceed: # Manage the frame refresh crt_frame = self.current_frame self.current_frame = -1 # Load the path self.getPath(path_id=path_id) self.changeFrame(frame_id=crt_frame)