55 In the main branch, the user able to click on the file items to display any image both before and after starting annotation. This feature did not work in the current version. The only way to browse between images is to click on the next and previous buttons. The file widget did not allow the user to click on file items to display images and see the annotations associated with them.
Changes
files_widget.py:
_handle_image_changed: This method is connected to the image_changed signal. It sets the current file item to the current image in the annotator_model. The currentItemChanged is blocked to prevent updating the model twice.
_handle_item_changed: This method is connected to the currentItemChanged event. When the current item in the file widget is set to a new item, it will emit this signal. The method then updates the current index and the previous index in the annotator model, which emits the image_changed signal to trigger other functions to record previous annotation and display the image.
annotation_model.py
self._annotation_started: This attribute allows the plugin to know whether the annotation has been started. If not, it should not record anything to the annotation list. is_annotation_started and set_annotation_started are get and set methods for this attribute.
annotation_controller.py
Change how unannotated images are written to a csv: When users stop annotating, instead of creating an empty list for each unannotated image starting from the current image index + 1, I changed it so that it checks every image from first to last to see if it has been annotated. If not, the image will be added to the annotation list with an empty annotation. This change fixes the problem where images did not get saved if they were skipped using the file widget.
Set self._annotation_started to False when stop_annotating() is called to stop recording annotations.
set_curr_img(): Add an if statement to make sure that the plugin only render annotations when the _created_annotations list is not empty.
images_view.py
Made a few changes to ensure the viewer and the file widget are cleared with no current item selected when the user shuffles, delete the current image, and delete all images.
main_view.py
_setup_annotating: Set the previous index to the current image index instead of None to ensure that the previous file item is unhighlighted after annotation starts.
Set self._annotation_started to True to start recording annotations.
Context
55 In the main branch, the user able to click on the file items to display any image both before and after starting annotation. This feature did not work in the current version. The only way to browse between images is to click on the next and previous buttons. The file widget did not allow the user to click on file items to display images and see the annotations associated with them.
Changes
files_widget.py:
_handle_image_changed
: This method is connected to theimage_changed
signal. It sets the current file item to the current image in theannotator_model
. The currentItemChanged is blocked to prevent updating the model twice._handle_item_changed
: This method is connected to thecurrentItemChanged
event. When the current item in the file widget is set to a new item, it will emit this signal. The method then updates the current index and the previous index in the annotator model, which emits theimage_changed
signal to trigger other functions to record previous annotation and display the image.annotation_model.py
self._annotation_started
: This attribute allows the plugin to know whether the annotation has been started. If not, it should not record anything to the annotation list.is_annotation_started
andset_annotation_started
are get and set methods for this attribute.annotation_controller.py
self._annotation_started
to False whenstop_annotating()
is called to stop recording annotations.set_curr_img()
: Add an if statement to make sure that the plugin only render annotations when the_created_annotations
list is not empty.images_view.py
main_view.py
_setup_annotating
: Set the previous index to the current image index instead of None to ensure that the previous file item is unhighlighted after annotation starts.self._annotation_started
to True to start recording annotations.