pic_scanner.models package
Submodules
pic_scanner.models.concern module
pic_scanner.models.image module
A module containing classes and functions for image processing, loading, and saving.
- class pic_scanner.models.image.ScannedImage(image_path, auto_checksum=True, backup_path=None)
Bases:
objectA class representing a scanned image.
- Properties:
- image_path (str, Path):
The path of the image.
- backed_up (bool):
The backup status of the image.
- concerns (list):
The list of concerns associated with the image.
- concern_count (int):
The number of concerns associated with the image.
- concern_names (list):
The names of the concerns associated with the image.
- Parameters:
image_path (str | Path)
auto_checksum (bool)
backup_path (str | Path)
- add_concern(concern)
Add a concern to the scanned image.
- backup(backup_dir, backup_name, **kwargs)
Backup the image.
- create_concerns(result)
Create concerns from a result dictionary.
- get_concerns()
Get the concerns associated with the image.
- get_concerns_by_name(name)
Get the concerns associated with the image by name.
- has_concern(name, case_sensitive)
Check if the image has a concern.
- move(new_dir, new_name)
Move the image to a new directory.
- __init__(image_path, auto_checksum=True, backup_path=None)
The constructor for ScannedImage class.
- Parameters:
image_path (str, Path) – The path of the image.
auto_checksum (bool)
backup_path (str | Path)
- add_concern(concern)
Add a concern to the scanned image.
- Parameters:
concern (Concern) – The concern to add to the scanned image.
- Returns:
None
- add_point_of_interest(point_of_interest)
Add a point of interest to the scanned image.
- Parameters:
point_of_interest (PointOfInterest) – The point of interest to add to the scanned image.
- Returns:
None
- property auto_checksum
Get the auto checksum status of the image.
- Returns:
The auto checksum status of the image.
- Return type:
bool
- property backed_up: bool
Get the backed up status of the image.
- Returns:
The backed up status of the image.
- Return type:
bool
- backup(backup_dir=None, backup_name=None, **kwargs)
Backup the scanned image.
- Parameters:
backup_dir (str, Path) – The directory to store the backup.
backup_name (str) – The name of the backup file.
- Returns:
The path of the backup file.
- Return type:
Path
- property backup_path
Get the backup path for the image.
- Returns:
The backup path for the image.
- Return type:
Path
- property checksum
Get the checksum of the image.
- Returns:
The checksum of the image.
- Return type:
str
- property concern_count
Get the number of concerns associated with the image.
- Returns:
The number of concerns associated with the image.
- Return type:
int
- property concern_names
Get the names of the concerns associated with the image.
- Return type:
list
- property concerns
Get the concerns associated with the image.
- Returns:
The concerns associated with the image.
- Return type:
list
- create_concerns(result)
Create concerns from a result dictionary.
- Parameters:
result (dict) – The result dictionary.
- Returns:
None
- property default_backup_path
Get the default backup path for the image.
- Returns:
The default backup path for the image.
- Return type:
Path
- get_checksum()
Get the checksum of the image.
- Returns:
The checksum of the image.
- Return type:
str
- get_concerns()
Get the concerns associated with the image.
- Returns:
The concerns associated with the image.
- Return type:
list
- get_concerns_by_name(name, case_sensitive=False)
Get the concerns associated with the image by name.
- Parameters:
name (str) – The name of the concern.
case_sensitive (bool) – If the check should be case-sensitive.
- Returns:
The concerns associated with the image by name.
- Return type:
list
- property getting_checksum
Get the getting checksum status of the image.
- Returns:
The getting checksum status of the image.
- Return type:
bool
- has_concern(name, case_sensitive=False)
Check if the image has a concern by name.
- Parameters:
name (str) – The name of the concern.
case_sensitive (bool) – If the check should be case sensitive.
- Returns:
True if the image has the concern, False otherwise.
- Return type:
bool
- has_point_of_interest(name, case_sensitive=False)
Check if the image has a point of interest by name.
- Parameters:
name (str) – The name of the point of interest.
case_sensitive (bool) – If the check should be case sensitive.
- Returns:
True if the image has the point of interest, False otherwise.
- Return type:
bool
- image_path = None
- move(new_dir, new_name=None)
Move the image to a new directory.
- Parameters:
new_dir (str) – The new directory to move the image to.
new_name (str) – The new name of the image.
- Returns:
None
- property point_of_interests
Get the points of interest associated with the image.
- Returns:
The points of interest associated with the image.
- Return type:
list
- class pic_scanner.models.image.ScannedImageCollection
Bases:
ScannedImageCollectionA class representing a collection of scanned images.
- Properties:
- images (list):
The list of scanned images.
- concern_names (list):
The names of the concerns associated with the images in the collection.
- concerns (list):
The concerns associated with the images in the collection.
- concern_count (int):
The number of concerns associated with the images in the collection.
- image_count (int):
The number of images in the collection.
- image_paths (list):
The paths of the images in the collection.
- __add_image(image)
Add a scanned image to the collection.
- Parameters:
image (ScannedImage) – The scanned image to add to the collection.
- Returns:
None
- __finalize()
Finalize the collection.
- Returns:
None
- __init__()
The constructor for ScannedImageCollection class.
- property concern_count
Get the number of concerns associated with the images in the collection.
- Returns:
The number of concerns associated with the images in the collection.
- Return type:
int
- property concern_names
Get the names of the concerns associated with the images in the collection.
- Returns:
The names of the concerns associated with the images in the collection.
- Return type:
list
- property concerns
Get the concerns associated with the images in the collection.
- Returns:
The concerns associated with the images in the collection.
- Return type:
list
- get_all_with_concern(concern_name, case_sensitive=False, score_threshold=None)
Get all images with a specific concern.
- Parameters:
concern_name (str) – The name of the concern.
case_sensitive (bool) – If the check should be case-sensitive.
score_threshold (Union[float, int], optional) – The threshold for the concern score.
- Returns:
A list of images with the concern.
- Return type:
list
- get_concern_names()
Get the names of the concerns associated with the images in the collection.
- Returns:
The names of the concerns associated with the images in the collection.
- Return type:
list
- get_concerns()
Get the concerns associated with the images in the collection.
- Returns:
The concerns associated with the images in the collection.
- Return type:
list
- get_concerns_by_name(name)
Get the concerns associated with the images in the collection by name.
- Parameters:
name (str) – The name of the concern.
- Returns:
The concerns associated with the images in the collection by name.
- Return type:
list
- get_concerns_by_score(score)
Get concerns by score.
- Parameters:
score – The score of the concern.
- Returns:
A list of concerns with the given score.
- Return type:
list
- get_image(image_path)
Get a scanned image from the collection by path.
- Parameters:
image_path (str, Path) – The path of the scanned image.
- Returns:
The scanned image.
- Return type:
- property image_count
Get the number of images in the collection.
- Returns:
The number of images in the collection.
- Return type:
int
- property image_paths
Get the paths of the images in the collection.
- Returns:
The paths of the images in the collection.
- Return type:
list
- move_all_with_concern(new_dir, concern_name)
Move all images with a specific concern to a new directory.
- Parameters:
new_dir (str, Path) – The new directory to move the images to.
concern_name (str) – The name of the concern.
- Returns:
None
- remove_image(image)
Remove a scanned image from the collection.
- Parameters:
image (ScannedImage) – The scanned image to remove from the collection.
- Returns:
None
- pic_scanner.models.image.create_scanned_image(result_struct)
Create a scanned image from a result dictionary.
- Parameters:
result_struct (dict) – The result dictionary.
- Returns:
The scanned image.
- Return type:
- pic_scanner.models.image.get_description(class_name)
Get the description of a label.
- Parameters:
class_name (str) – The name of the label.
- Returns:
The description of the label.
- Return type:
str