API Reference¶
Application¶
App Module¶
find_and_import_subclass(file_path, base_class_name)
¶
Find and import the first subclass of a given base class in a Python file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
The path to the Python file to inspect. |
required |
base_class_name
|
str
|
The name of the base class to look for subclasses of. |
required |
Returns:
Name | Type | Description |
---|---|---|
type |
The first subclass found, or None if no subclass is found. |
Source code in imagebaker/window/app.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
load_models(file_path)
¶
Dynamically load the LOADED_MODELS object from the specified file.
Source code in imagebaker/window/app.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
run(models_file=typer.Option('loaded_models.py', help='Path to the Python file defining LOADED_MODELS.'), project_dir=typer.Option('.', help='The project directory to use for the application.'), configs_file=typer.Option('imagebaker/core/configs.py', help='The Python file to search for LayerConfig and CanvasConfig subclasses.'))
¶
Run the ImageBaker application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
models_file
|
str
|
Path to the Python file defining LOADED_MODELS. |
Option('loaded_models.py', help='Path to the Python file defining LOADED_MODELS.')
|
project_dir
|
str
|
The project directory to use for the application. |
Option('.', help='The project directory to use for the application.')
|
configs_file
|
str
|
The Python file to search for LayerConfig and CanvasConfig subclasses. |
Option('imagebaker/core/configs.py', help='The Python file to search for LayerConfig and CanvasConfig subclasses.')
|
Source code in imagebaker/window/app.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
Tabs¶
Layerify Tab¶
Bases: QWidget
Layerify Tab implementation
Source code in imagebaker/tabs/layerify_tab.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
|
add_baked_result(baking_result)
¶
Add a baked result to the baked results list and update the image list.
Source code in imagebaker/tabs/layerify_tab.py
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
|
add_layer(layer)
¶
Add a new layer to the tab.
Source code in imagebaker/tabs/layerify_tab.py
595 596 597 598 599 600 601 |
|
add_new_label()
¶
Add a new label to the predefined labels.
Source code in imagebaker/tabs/layerify_tab.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
|
choose_color()
¶
Choose a color for the current label.
Source code in imagebaker/tabs/layerify_tab.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
|
clear_annotations()
¶
Safely clear all annotations
Source code in imagebaker/tabs/layerify_tab.py
227 228 229 230 231 232 233 234 235 236 |
|
create_toolbar()
¶
Create Layerify-specific toolbar
Source code in imagebaker/tabs/layerify_tab.py
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
|
handle_label_change(index)
¶
Handle the label change event.
Source code in imagebaker/tabs/layerify_tab.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
|
handle_model_change(index)
¶
Handle the model change event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index
|
int
|
The index of the selected model. |
required |
Source code in imagebaker/tabs/layerify_tab.py
450 451 452 453 454 455 456 457 458 459 460 461 |
|
handle_model_result(predictions)
¶
A slot to handle the model prediction results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predictions
|
list[PredictionResult]
|
The list of prediction results. |
required |
Source code in imagebaker/tabs/layerify_tab.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
|
handle_predict()
¶
Handle the predict button click event.
Source code in imagebaker/tabs/layerify_tab.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
init_ui()
¶
Initialize the UI components
Source code in imagebaker/tabs/layerify_tab.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
keyPressEvent(event)
¶
Handle key press events for setting labels and deleting annotations.
Source code in imagebaker/tabs/layerify_tab.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
|
layerify_all()
¶
Layerify all annotations in the current layer.
Source code in imagebaker/tabs/layerify_tab.py
603 604 605 606 607 608 609 610 611 612 613 |
|
load_annotations()
¶
Load annotations from a JSON file.
Source code in imagebaker/tabs/layerify_tab.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
|
load_default_image()
¶
Load a default image from the assets folder.
Source code in imagebaker/tabs/layerify_tab.py
280 281 282 283 284 285 286 287 288 289 290 |
|
load_default_images()
¶
Load the first set of images as the default.
Source code in imagebaker/tabs/layerify_tab.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
on_annotation_added(annotation)
¶
Handle annotation added event
Parameters:
Name | Type | Description | Default |
---|---|---|---|
annotation
|
Annotation
|
The annotation that was added. |
required |
Source code in imagebaker/tabs/layerify_tab.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
on_annotation_updated(annotation)
¶
A slot to handle the annotation updated signal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
annotation
|
Annotation
|
The updated annotation. |
required |
Source code in imagebaker/tabs/layerify_tab.py
255 256 257 258 259 260 261 262 263 264 265 266 |
|
on_image_selected(image_entry)
¶
Handle image selection from the image list panel.
Source code in imagebaker/tabs/layerify_tab.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
save_annotations()
¶
Save annotations to a JSON file.
Source code in imagebaker/tabs/layerify_tab.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
|
select_folder()
¶
Allow the user to select a folder and load images from it.
Source code in imagebaker/tabs/layerify_tab.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
|
show_next_image()
¶
Show next image in the list. If at the end, show first image.
Source code in imagebaker/tabs/layerify_tab.py
739 740 741 742 743 744 745 746 747 748 |
|
show_prev_image()
¶
Show previous image in the list. If at the start, show last image.
Source code in imagebaker/tabs/layerify_tab.py
750 751 752 753 754 755 756 757 758 759 |
|
update_annotation_list()
¶
Update the annotation list with the current annotations.
Source code in imagebaker/tabs/layerify_tab.py
517 518 519 |
|
update_label_combo()
¶
Add predefined labels to the label combo box.
This method is called when a new label is added.
Source code in imagebaker/tabs/layerify_tab.py
268 269 270 271 272 273 274 275 276 277 278 |
|
Baker Tab¶
Bases: QWidget
Baker Tab implementation
Source code in imagebaker/tabs/baker_tab.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|
add_layer(layer)
¶
Add a new layer to the canvas.
Source code in imagebaker/tabs/baker_tab.py
435 436 437 438 439 |
|
clear_states()
¶
Clear all saved states and disable the timeline slider.
Source code in imagebaker/tabs/baker_tab.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
create_toolbar()
¶
Create Baker-specific toolbar
Source code in imagebaker/tabs/baker_tab.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
export_current_state()
¶
Export the current state as an image.
Source code in imagebaker/tabs/baker_tab.py
424 425 426 427 |
|
export_for_annotation()
¶
Export the baked states for annotation.
Source code in imagebaker/tabs/baker_tab.py
346 347 348 349 |
|
export_locally()
¶
Export the baked states locally.
Source code in imagebaker/tabs/baker_tab.py
351 352 353 354 |
|
generate_state_previews()
¶
Generate previews for each state.
Source code in imagebaker/tabs/baker_tab.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
init_ui()
¶
Initialize the UI components.
Source code in imagebaker/tabs/baker_tab.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
keyPressEvent(event)
¶
Handle key press events.
Source code in imagebaker/tabs/baker_tab.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|
on_canvas_added(new_canvas)
¶
Handle the addition of a new canvas.
Source code in imagebaker/tabs/baker_tab.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
on_canvas_deleted(canvas)
¶
Handle the deletion of a canvas.
Source code in imagebaker/tabs/baker_tab.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
on_canvas_selected(canvas)
¶
Handle canvas selection from the CanvasList.
Source code in imagebaker/tabs/baker_tab.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
open_color_picker()
¶
Open a color picker dialog to select a custom color.
Source code in imagebaker/tabs/baker_tab.py
339 340 341 342 343 344 |
|
play_saved_states()
¶
Play the saved states in sequence.
Source code in imagebaker/tabs/baker_tab.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|
predict_state()
¶
Pass the current state to predict.
Source code in imagebaker/tabs/baker_tab.py
429 430 431 432 433 |
|
save_current_state()
¶
Save the current state of the canvas.
Source code in imagebaker/tabs/baker_tab.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
seek_state(step)
¶
Seek to a specific state using the timeline slider.
Source code in imagebaker/tabs/baker_tab.py
415 416 417 418 419 420 421 422 |
|
toggle_drawing_mode()
¶
Toggle drawing mode on the current canvas.
Source code in imagebaker/tabs/baker_tab.py
317 318 319 320 321 322 323 324 325 326 |
|
toggle_erase_mode()
¶
Toggle drawing mode on the current canvas.
Source code in imagebaker/tabs/baker_tab.py
328 329 330 331 332 333 334 335 336 337 |
|
update_list(layer=None)
¶
Update the layer list and layer settings.
Source code in imagebaker/tabs/baker_tab.py
170 171 172 173 174 175 176 |
|
update_slider_range(steps)
¶
Update the slider range based on the number of steps.
Source code in imagebaker/tabs/baker_tab.py
99 100 101 102 103 104 |
|
update_thumbnail(step, thumbnail_label)
¶
Update the thumbnail for a specific step.
Source code in imagebaker/tabs/baker_tab.py
163 164 165 166 167 168 |
|
List Views¶
Image List Panel¶
Bases: QDockWidget
Source code in imagebaker/list_views/image_list.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
handle_item_clicked(item)
¶
Handle item click and emit the imageSelected signal.
Source code in imagebaker/list_views/image_list.py
136 137 138 139 140 |
|
init_ui()
¶
Initialize the UI for the image list panel.
Source code in imagebaker/list_views/image_list.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
show_next_page()
¶
Show the next page of images
Source code in imagebaker/list_views/image_list.py
77 78 79 80 81 |
|
show_prev_page()
¶
Show the previous page of images
Source code in imagebaker/list_views/image_list.py
83 84 85 86 87 |
|
update_image_list(image_entries)
¶
Update the image list with image paths and baked results.
Source code in imagebaker/list_views/image_list.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
Annotation List¶
Bases: QDockWidget
Source code in imagebaker/list_views/annotation_list.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
sizeHint()
¶
Calculate the preferred size based on the content.
Source code in imagebaker/list_views/annotation_list.py
188 189 190 191 192 |
|
Canvas List¶
Bases: QDockWidget
Source code in imagebaker/list_views/canvas_list.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
create_new_canvas()
¶
Create a new canvas and emit the canvasAdded signal.
Source code in imagebaker/list_views/canvas_list.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
delete_canvas(canvas)
¶
Delete a canvas from the list.
Source code in imagebaker/list_views/canvas_list.py
176 177 178 179 180 181 182 183 184 185 |
|
handle_item_clicked(item)
¶
Handle item click and emit the canvasSelected signal.
Source code in imagebaker/list_views/canvas_list.py
170 171 172 173 174 |
|
init_ui()
¶
Initialize the UI for the canvas list panel.
Source code in imagebaker/list_views/canvas_list.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
show_next_page()
¶
Show the next page of canvases.
Source code in imagebaker/list_views/canvas_list.py
100 101 102 103 104 |
|
show_prev_page()
¶
Show the previous page of canvases.
Source code in imagebaker/list_views/canvas_list.py
106 107 108 109 110 |
|
update_canvas_list()
¶
Update the canvas list with pagination.
Source code in imagebaker/list_views/canvas_list.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
Layer List¶
Bases: QDockWidget
Source code in imagebaker/list_views/layer_list.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
add_layer(layer=None)
¶
Add a new layer to the list
Source code in imagebaker/list_views/layer_list.py
352 353 354 355 356 357 358 |
|
clear_layers()
¶
Clear all layers from the list
Source code in imagebaker/list_views/layer_list.py
74 75 76 77 |
|
confirm_delete_layer(index)
¶
Show confirmation dialog before deleting a layer
Source code in imagebaker/list_views/layer_list.py
301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
delete_layer(index)
¶
Delete a layer by index
Source code in imagebaker/list_views/layer_list.py
331 332 333 334 335 336 337 338 339 |
|
delete_selected_layer()
¶
Delete the currently selected layer with confirmation
Source code in imagebaker/list_views/layer_list.py
325 326 327 328 329 |
|
get_selected_layers()
¶
Returns list of currently selected BaseLayer objects
Source code in imagebaker/list_views/layer_list.py
366 367 368 369 370 371 372 373 |
|
keyPressEvent(event)
¶
Handle key presses.
Source code in imagebaker/list_views/layer_list.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
list_key_press_event(event)
¶
Handle key press events in the list widget
Source code in imagebaker/list_views/layer_list.py
315 316 317 318 319 320 321 322 323 |
|
on_item_clicked(item)
¶
Handle layer selection with: - Left click only: Toggle clicked layer and deselect others - Ctrl+Left click: Toggle clicked layer only (keep others selected)
Source code in imagebaker/list_views/layer_list.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
on_layer_selected(indices)
¶
Select multiple layers by indices
Source code in imagebaker/list_views/layer_list.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
on_rows_moved(parent, start, end, destination, row)
¶
Handle rows being moved in the list widget via drag and drop
Source code in imagebaker/list_views/layer_list.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
select_layer(layer)
¶
Select a specific layer
Source code in imagebaker/list_views/layer_list.py
361 362 363 364 |
|
toggle_annotation_export(index, state)
¶
Toggle annotation export for a layer by index
Source code in imagebaker/list_views/layer_list.py
237 238 239 240 241 242 243 244 245 246 247 |
|
toggle_visibility(index)
¶
Toggle visibility of a layer by index
Source code in imagebaker/list_views/layer_list.py
341 342 343 344 345 346 347 348 349 350 |
|
update_list()
¶
Update the list widget with current layers
Source code in imagebaker/list_views/layer_list.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
Layer Settings¶
Bases: QDockWidget
Source code in imagebaker/list_views/layer_settings.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
create_slider(label, min_val, max_val, default, scale_factor=1)
¶
Create a slider with a label and value display.
Source code in imagebaker/list_views/layer_settings.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
emit_bake_settings()
¶
Emit the bake settings signal.
Source code in imagebaker/list_views/layer_settings.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
init_ui()
¶
Initialize the UI elements.
Source code in imagebaker/list_views/layer_settings.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
on_slider_released()
¶
Update layer only when slider is released
Source code in imagebaker/list_views/layer_settings.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
set_selected_layer(layer)
¶
Set the currently selected layer.
Source code in imagebaker/list_views/layer_settings.py
185 186 187 188 |
|
update_sliders()
¶
Update slider values based on the selected layer.
Source code in imagebaker/list_views/layer_settings.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
Layers¶
Base Layer¶
Bases: QWidget
Source code in imagebaker/layers/base_layer.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 |
|
image
property
writable
¶
Get the current image of the canvas layer.
Returns:
Name | Type | Description |
---|---|---|
QPixmap |
The current image of the canvas layer. |
copy()
¶
Create a copy of the layer, including its properties and annotations. Should be overridden by subclasses to copy additional properties.
Source code in imagebaker/layers/base_layer.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
|
get_layer(id)
¶
Get a child layer by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the layer to retrieve. |
required |
Returns:
Type | Description |
---|---|
BaseLayer
|
Child of BaseLayer: The child layer with the specified ID, or None if not found |
Source code in imagebaker/layers/base_layer.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
get_thumbnail(annotation=None)
¶
Generate a thumbnail for the layer or a specific annotation.
Source code in imagebaker/layers/base_layer.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
|
handle_mouse_move(event)
¶
Handle mouse move events for panning, drawing, erasing, or transforming layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
QMouseEvent
|
The mouse move event. |
required |
Source code in imagebaker/layers/base_layer.py
614 615 616 617 618 619 620 621 |
|
handle_mouse_press(event)
¶
Handle mouse press events for selecting layers, initiating transformations, or starting drawing/erasing operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
QMouseEvent
|
The mouse press event. |
required |
Source code in imagebaker/layers/base_layer.py
604 605 606 607 608 609 610 611 612 |
|
handle_mouse_release(event)
¶
Handle mouse release events, such as resetting the active handle or stopping drawing/erasing operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
QMouseEvent
|
The mouse release event. |
required |
Source code in imagebaker/layers/base_layer.py
623 624 625 626 627 628 629 630 631 |
|
handle_wheel(event)
¶
Handle mouse wheel events for adjusting the brush size or zooming the canvas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
QWheelEvent
|
The wheel event. |
required |
Source code in imagebaker/layers/base_layer.py
633 634 635 636 637 638 639 640 |
|
minimumSizeHint()
¶
Return the minimum size hint for the widget.
Source code in imagebaker/layers/base_layer.py
285 286 287 |
|
save_current_state(steps=1)
¶
Save the current state of the layer, including intermediate states calculated between the previous and current states.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
steps
|
int
|
The number of intermediate steps to calculate between |
1
|
Returns:
Type | Description |
---|---|
None |
Source code in imagebaker/layers/base_layer.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
set_image(image_path)
¶
Set the image for the layer from a file path, QPixmap, or QImage.
Source code in imagebaker/layers/base_layer.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
set_mode(mode)
¶
Set the mouse interaction mode for the layer.
Source code in imagebaker/layers/base_layer.py
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
|
update_cursor()
¶
Update the cursor based on the current mouse mode.
Source code in imagebaker/layers/base_layer.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
widget_to_image_pos(pos)
¶
Convert a widget position to an image position.
Source code in imagebaker/layers/base_layer.py
289 290 291 292 293 294 295 296 |
|
Canvas Layer¶
Bases: BaseLayer
Source code in imagebaker/layers/canvas_layer.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
|
add_layer(layer, index=-1)
¶
This function adds a new layer to the canvas layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer
|
BaseLayer
|
The layer to add. |
required |
index
|
int
|
The index at which to add the layer. Defaults to -1. |
-1
|
Raises:
Type | Description |
---|---|
ValueError
|
If the layer is not a BaseLayer instance |
Source code in imagebaker/layers/canvas_layer.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
|
clear_layers()
¶
Clear all layers from the canvas layer.
Source code in imagebaker/layers/canvas_layer.py
747 748 749 750 751 752 753 754 |
|
export_baked_states(export_to_annotation_tab=False)
¶
Export all the states stored in self.states.
Source code in imagebaker/layers/canvas_layer.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 |
|
export_current_state(export_to_annotation_tab=False)
¶
Export the current state of the canvas layer to an image file or annotation tab.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_to_annotation_tab
|
bool
|
Whether to export the image to the annotation tab. Defaults to False. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If the layer is not a BaseLayer instance |
Source code in imagebaker/layers/canvas_layer.py
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 |
|
handle_baker_error(error_msg)
¶
To handle any errors that occur during the baking process.
Source code in imagebaker/layers/canvas_layer.py
865 866 867 868 869 870 871 872 |
|
handle_key_release(event)
¶
Handle key release events, such as resetting the mouse mode when the Control key is released.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
QKeyEvent
|
The key release event. |
required |
Source code in imagebaker/layers/canvas_layer.py
76 77 78 79 80 81 82 83 84 85 |
|
init_ui()
¶
Initialize the user interface for the canvas layer, including size policies and storing the original size of the layer.
Source code in imagebaker/layers/canvas_layer.py
67 68 69 70 71 72 73 74 |
|
paint_layer(painter)
¶
Paint the canvas layer, including all visible layers, their transformations, and any drawing states or selection indicators.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
painter
|
QPainter
|
The painter object used for rendering. |
required |
Source code in imagebaker/layers/canvas_layer.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|
play_states()
¶
Play all the states stored in self.states.
Source code in imagebaker/layers/canvas_layer.py
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
|
predict_state()
¶
To send the current state to the prediction tab.
Source code in imagebaker/layers/canvas_layer.py
874 875 876 877 878 |
|
seek_state(step)
¶
Seek to a specific state using the timeline slider.
Source code in imagebaker/layers/canvas_layer.py
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 |
|
Annotable Layer¶
Bases: BaseLayer
Source code in imagebaker/layers/annotable_layer.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 |
|
apply_opacity()
¶
Apply opacity to the QPixmap image.
Source code in imagebaker/layers/annotable_layer.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
draw_annotation(painter, annotation, is_temp=False)
¶
Draw annotation on the image.
Source code in imagebaker/layers/annotable_layer.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
find_annotation_and_handle_at(pos, margin=10.0)
¶
Find annotation and specific handle at given position
Source code in imagebaker/layers/annotable_layer.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
Workers¶
Baker Worker¶
Bases: QObject
Source code in imagebaker/workers/baker_worker.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
Layerify Worker¶
Bases: QObject
Source code in imagebaker/workers/layerify_worker.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
Model Prediction Worker¶
Bases: QObject
Source code in imagebaker/workers/model_worker.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
Utilities¶
Image Utilities¶
draw_annotations(image, annotations)
¶
Draw annotations on an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image
|
ndarray
|
Image to draw on. |
required |
annotations
|
list[Annotation]
|
List of annotations to draw. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Image with annotations drawn. |
Source code in imagebaker/utils/image.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
qpixmap_to_numpy(pixmap)
¶
Convert QPixmap to RGBA numpy array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixmap
|
QPixmap | QImage
|
The QPixmap to convert |
required |
Returns:
Type | Description |
---|---|
ndarray
|
numpy.ndarray: Array with shape (height, width, 4) containing RGBA values |
Source code in imagebaker/utils/image.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
State Utilities¶
calculate_intermediate_states(previous_state, current_state, steps)
¶
Calculate intermediate states between previous_state and current_state for a layer. Append the current_state to the list of states after calculating intermediates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
previous_state
|
LayerState
|
Previous state of the layer. |
required |
current_state
|
LayerState
|
Current state of the layer. |
required |
steps
|
int
|
Number of intermediate states to calculate. |
required |
Source code in imagebaker/utils/state_utils.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
Transform Mask Utilities¶
mask_to_polygons(mask, min_polygon_area=10, merge_polygons=False, merge_distance=5)
¶
Convert a binary mask to a list of polygons. Each polygon is a list of (x, y) coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
ndarray
|
Binary mask (0 or 255). |
required |
min_polygon_area
|
float
|
Minimum area for a polygon to be included. |
10
|
merge_polygons
|
bool
|
If True, merges nearby/overlapping polygons. |
False
|
merge_distance
|
int
|
Max distance between polygons to merge (if merge_polygons=True). |
5
|
Returns:
Type | Description |
---|---|
List[List[Tuple[int, int]]]
|
List[List[Tuple[int, int]]]: List of polygons, each represented as a list of (x, y) points. |
Source code in imagebaker/utils/transform_mask.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
mask_to_rectangles(mask, merge_rectangles=False, merge_threshold=1, merge_epsilon=0.5)
¶
Convert a binary mask to a list of rectangles. Each rectangle is a tuple of (x, y, w, h).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
ndarray
|
Binary mask (0 or 255). |
required |
merge_rectangles
|
bool
|
If True, merges overlapping or nearby rectangles. |
False
|
merge_threshold
|
int
|
Min number of rectangles to merge into one. |
1
|
merge_epsilon
|
float
|
Controls how close rectangles must be to merge (0.0 to 1.0). |
0.5
|
Returns:
Type | Description |
---|---|
List[Tuple[int, int, int, int]]
|
List[Tuple[int, int, int, int]]: List of rectangles, each as (x, y, w, h). |
Source code in imagebaker/utils/transform_mask.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|