Esempio n. 1
0
    def importTracker(self):

        # Get the file name
        tracker_file, _ = qtw.QFileDialog.getOpenFileName(
            self.parent, "Load Tracker...", "", "JSON Archive (*.json)")

        if tracker_file != "":

            # Prompt the user for the file name
            tracker_name, ok = qtw.QInputDialog.getText(
                self, "Tracker Name", "Name of the new tracker?")

            if ok:

                # Initialise a new session
                import_session = startSession()

                # Load the parameters in the session
                import_session.load(tracker_file)

                # Load the tracker in the class
                blank_session = loadTrackerConfig('Default')
                blank_session.name = tracker_name
                blank_session.session = import_session

                # Save the tracker in the memory
                blank_session.save()

                # Refresh the display
                self.fillTrackerTable()
Esempio n. 2
0
    def makeNewTracker(self):

        # Make a blank tracker
        blank_session = loadTrackerConfig('Default')
        blank_session = deepcopy(blank_session)

        # Open the window
        openWindow(self.parent,
                   TrackerSettingsWindow,
                   'tracker_settings',
                   detection_session=blank_session)
Esempio n. 3
0
    def editTracker(self, tracker_id=0):

        # Get the name of the tracker
        tracker_name = self.tracker_list[tracker_id]

        # Load the selected tracker
        tracker_session = loadTrackerConfig(tracker_name)
        tracker_session = deepcopy(tracker_session)

        # Open the window
        openWindow(self.parent,
                   TrackerSettingsWindow,
                   'tracker_settings',
                   detection_session=tracker_session)
Esempio n. 4
0
    def initializeDetection(self, tracker_name=None):

        # Get the tracker name
        if tracker_name is None:
            tracker_name = self.parent.config.tracker
        self.current_tracker = tracker_name

        # Start the session
        self.trajectory_session = loadTrackerConfig(tracker_name)
        self.detection_session = self.trajectory_session.session

        # Update the display
        self.minIntensityEntry.setText(str(self.detection_session.minmass))
        self.diameterEntry.setText(str(self.detection_session.diameter))
        self.darkSpotCheckBox.setChecked(self.detection_session.invert)
Esempio n. 5
0
    def exportTracker(self):

        # Prepare the list of exportable settings
        all_trackers = listTrackerConfigs()
        tracker_list = [x for x in all_trackers if x != 'Default']

        # Proceed if there are enough trackers in the memory
        if len(tracker_list) >= 1:

            # Get the tracker to export
            tracker_name, ok = qtw.QInputDialog.getItem(
                self, "Tracker Selection", "Tracker to export?", tracker_list,
                0, False)

            # Export the selection
            if ok:

                # Get the file name
                tracker_file, _ = qtw.QFileDialog.getSaveFileName(
                    self.parent, "Save Tracker...", "",
                    "JSON Archive (*.json)")

                if tracker_file != "":

                    # Load the selection
                    export_session = loadTrackerConfig(tracker_name)

                    # Save the selection in file
                    export_session.session.save(tracker_file)

                    # Message to confirm the export
                    notificationFileSaved(tracker_file)

        # Display an error message if there are nothing
        else:
            errorMessage("No Tracker",
                         "There is no tracker to export in the memory.")