commands
sleap.gui.commands
¶
Module for gui command context and commands objects.
Each open project (i.e., MainWindow) will have its own CommandContext.
The context enables commands to access and modify the GuiState and Labels,
as well as potentially maintaining a command history (so we can add support for
undo!). See sleap.gui.app for how the context is created and used.
Every command will have both a method in CommandContext (this is what should
be used to trigger the command, e.g., connected to the menu action) and a
class which inherits from AppCommand (or a more specialized class such as
NavCommand, GoIteratorCommand, or EditCommand). Note that this code relies
on inheritance, so some care and attention is required.
A typical command will override the ask and do_action methods. If the
command updates something which affects the GUI, it should override the topic
attribute (this then gets passed back to the update_callback from the context.
If a command doesn't require any input from the user, then it doesn't need to
override the ask method.
If it's not possible to separate the GUI "ask" and the non-GUI "do" code, then
instead of ask and do_action you should add an ask_and_do method
(for instance, DeleteDialogCommand and MergeProject show dialogues which
handle both the GUI and the action). Ideally we'd endorse separation of "ask"
and "do" for all commands (this is important if we're going to implement undo)--
for now it's at least easy to see where this separation is violated.
Classes:
| Name | Description |
|---|---|
AddInstance |
|
AddMissingInstanceNodes |
|
AddVideo |
|
AppCommand |
Base class for specific commands. |
CommandContext |
Context within in which commands are executed. |
DeleteFrameLimitPredictions |
|
DeleteMultipleTracks |
|
EditCommand |
Class for commands which change data in project. |
ExportLabeledClip |
Export a labeled video clip with labels and edges. |
ExportLabelsSubset |
Export a subset of labels to a new file with either images or a trimmed video. |
ExportVideoClip |
Base class for exporting video clips. |
FakeApp |
Use if you want to execute commands independently of the GUI app. |
GoIteratorCommand |
|
InstanceDeleteCommand |
|
LoadLabelsObject |
|
OpenSkeleton |
|
ReplaceVideo |
|
SaveProjectAs |
|
SetInstancePointLocations |
Sets locations for node(s) for an instance. |
SetInstancePointVisibility |
Toggles visibility set for a node for an instance. |
ToggleGrayscale |
|
UpdateTopic |
Topics so context can tell callback what was updated by the command. |
Functions:
| Name | Description |
|---|---|
copy_to_clipboard |
Copy a string to the system clipboard. |
export_dataset_gui |
Export dataset with image data and display progress GUI dialog. |
get_new_version_filename |
Increment version number in filenames that end in |
open_file |
Opens file in native system file browser or registered application. |
open_website |
Open website in default browser. |
AddInstance
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
create_new_instance |
Create new instance. |
fill_missing_nodes |
Fill in missing nodes for new instance. |
find_instance_to_copy_from |
Find instance to copy from. |
get_previous_frame_index |
Returns index of previous frame. |
set_visible_nodes |
Sets visible nodes for new instance. |
Source code in sleap/gui/commands.py
3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 | |
create_new_instance(context, from_predicted, copy_instance, mark_complete, init_method, location, from_prev_frame, offset=0)
staticmethod
¶
Create new instance.
Source code in sleap/gui/commands.py
3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 | |
fill_missing_nodes(context, copy_instance, init_method, new_instance, location)
staticmethod
¶
Fill in missing nodes for new instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
copy_instance
|
Optional[Union[Instance, PredictedInstance]]
|
The instance to copy from. |
required |
init_method
|
str
|
The initialization method. |
required |
new_instance
|
Instance
|
The new instance. |
required |
location
|
Optional[QPoint]
|
The location of the instance. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in sleap/gui/commands.py
3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 | |
find_instance_to_copy_from(context, copy_instance, init_method)
staticmethod
¶
Find instance to copy from.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
copy_instance
|
Optional[Union[Instance, PredictedInstance]]
|
The |
required |
init_method
|
bool
|
The initialization method. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[Optional[Union[Instance, PredictedInstance]], Optional[PredictedInstance], bool]
|
The instance to copy from, the predicted instance (if it is from a predicted instance, else None), and whether it's from a previous frame. |
Source code in sleap/gui/commands.py
3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 | |
get_previous_frame_index(context)
staticmethod
¶
Returns index of previous frame.
Source code in sleap/gui/commands.py
3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 | |
set_visible_nodes(context, copy_instance, new_instance, mark_complete, init_method, location=None, offset=0)
staticmethod
¶
Sets visible nodes for new instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
copy_instance
|
Optional[Union[Instance, PredictedInstance]]
|
The instance to copy from. |
required |
new_instance
|
Instance
|
The new instance. |
required |
mark_complete
|
bool
|
Whether to mark the instance as complete. |
required |
init_method
|
str
|
The initialization method. |
required |
location
|
Optional[QPoint]
|
The location of the mouse click if any. |
None
|
offset
|
int
|
The offset to apply to all nodes. |
0
|
Returns:
| Type | Description |
|---|---|
bool
|
Whether the new instance has missing nodes. |
Source code in sleap/gui/commands.py
3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 | |
AddMissingInstanceNodes
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
get_rect_center_xy |
Returns x, y at center of rect. |
get_xy_in_rect |
Returns random x, y coordinates within given rect. |
Source code in sleap/gui/commands.py
3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 | |
get_rect_center_xy(rect)
staticmethod
¶
Returns x, y at center of rect.
Source code in sleap/gui/commands.py
3764 3765 3766 | |
get_xy_in_rect(rect)
staticmethod
¶
Returns random x, y coordinates within given rect.
Source code in sleap/gui/commands.py
3757 3758 3759 3760 3761 3762 | |
AddVideo
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
ask |
Shows gui for adding video to project. |
Source code in sleap/gui/commands.py
2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 | |
ask(context, params)
staticmethod
¶
Shows gui for adding video to project.
Source code in sleap/gui/commands.py
2100 2101 2102 2103 2104 2105 | |
AppCommand
¶
Base class for specific commands.
Note that this is not an abstract base class. For specific commands, you
should override ask and/or do_action methods, or add an ask_and_do
method. In many cases you'll want to override the topics and does_edits
attributes. That said, these are not virtual methods/attributes and have
are implemented in the base class with default behaviors (i.e., doing
nothing).
You should not override execute or do_with_signal.
Attributes:
| Name | Type | Description |
|---|---|---|
topics |
List[UpdateTopic]
|
List of |
does_edits |
bool
|
Whether command will modify data that could be saved. |
Methods:
| Name | Description |
|---|---|
ask |
Method for information gathering. |
do_action |
Method for performing action. |
do_with_signal |
Wrapper to perform action and notify/track changes. |
execute |
Entry point for running command. |
Source code in sleap/gui/commands.py
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 | |
ask(context, params)
staticmethod
¶
Method for information gathering.
Returns:
| Type | Description |
|---|---|
bool
|
Whether to perform action. By default returns True, but this is where we should return False if we prompt user for confirmation and they abort. |
Source code in sleap/gui/commands.py
197 198 199 200 201 202 203 204 205 206 | |
do_action(context, params)
staticmethod
¶
Method for performing action.
Source code in sleap/gui/commands.py
208 209 210 211 | |
do_with_signal(context, params)
classmethod
¶
Wrapper to perform action and notify/track changes.
Don't override this method!
Source code in sleap/gui/commands.py
213 214 215 216 217 218 219 220 221 222 223 | |
execute(context, params=None)
¶
Entry point for running command.
This calls internal methods to gather information required for execution, perform the action, and notify about changes.
Ideally, any information gathering should be performed in the ask
method, and be added to the params dictionary which then gets
passed to do_action. The ask method should not modify state.
(This will make it easier to add support for undo,
using an undo_action which will be given the same params
dictionary.)
If it's not possible to easily separate information gathering from
performing the action, the child class should implement ask_and_do,
which it turn should call do_with_signal to notify about changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
'CommandContext'
|
This is the |
required |
params
|
dict
|
Dictionary of any params for command. |
None
|
Source code in sleap/gui/commands.py
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 | |
CommandContext
¶
Context within in which commands are executed.
When you create a new command, you should both create a class for the
command (which inherits from CommandClass) and add a distinct method
for the command in the CommandContext class. This method is what should
be connected/called from other code to invoke the command.
Attributes:
| Name | Type | Description |
|---|---|---|
state |
GuiState
|
The |
app |
'MainWindow'
|
The |
update_callback |
Optional[Callable]
|
A callback to receive update notifications.
This function should accept a list of |
Methods:
| Name | Description |
|---|---|
addCurrentFrameAsSuggestion |
Add current frame as a suggestion. |
addTrack |
Creates new track and moves selected instance into this track. |
addUserInstancesFromPredictions |
Create user instance from a predicted instance. |
addVideo |
Shows gui for adding videos to project. |
changestack_clear |
Clears stack of changes. |
changestack_push |
Adds to stack of changes made by user. |
changestack_savepoint |
Marks that project was just saved. |
checkForUpdates |
Check for updates online. |
clearSuggestions |
Clear all suggestions. |
completeInstanceNodes |
Adds missing nodes to given instance. |
copyInstance |
Copy the selected instance to the instance clipboard. |
copyInstanceTrack |
Copies the selected instance's track to the track clipboard. |
deleteAreaPredictions |
Gui for deleting instances within some rect on frame images. |
deleteClipPredictions |
Deletes all predictions within selected range of video frames. |
deleteDialog |
Deletes using options selected in a dialog. |
deleteEdge |
Removes (currently selected) edge from skeleton. |
deleteFrameLimitPredictions |
Gui for deleting instances beyond some frame number. |
deleteFramePredictions |
Deletes all predictions on current frame. |
deleteInstanceLimitPredictions |
Gui for deleting instances beyond some number in each frame. |
deleteLowScorePredictions |
Gui for deleting instances below some score threshold. |
deleteMultipleTracks |
Delete all tracks. |
deleteNode |
Removes (currently selected) node from skeleton. |
deletePredictions |
Deletes all predicted instances in project. |
deleteSelectedInstance |
Deletes currently selected instance. |
deleteSelectedInstanceTrack |
Deletes all instances from track of currently selected instance. |
deleteTrack |
Delete a track and remove from all instances. |
execute |
Execute command in this context, passing named arguments. |
exportAnalysisFile |
Shows gui for exporting analysis h5 file. |
exportCSVFile |
Shows gui for exporting analysis csv file. |
exportFullPackage |
Gui for exporting the dataset with any labeled frames and suggestions. |
exportLabeledClip |
Shows gui for exporting clip with visual annotations. |
exportLabelsSubset |
Exports a selected range of video frames and their corresponding labels. |
exportNWB |
Show gui for exporting nwb file. |
exportTrainingPackage |
Gui for exporting the dataset with user-labeled images and suggestions. |
exportUserLabelsPackage |
Gui for exporting the dataset with user-labeled images. |
from_labels |
Creates a command context for use independently of GUI app. |
generateSuggestions |
Generates suggestions using given params dictionary. |
gotoFrame |
Shows gui to go to frame by number. |
gotoVideoAndFrame |
Activates video and goes to frame. |
importAnalysisFile |
Imports SLEAP analysis hdf5 files. |
importCoco |
Imports COCO datasets. |
importDLC |
Imports DeepLabCut datasets. |
importDLCFolder |
Imports multiple DeepLabCut datasets. |
importNWB |
Imports NWB datasets. |
lastInteractedFrame |
Goes to last frame that user interacted with. |
loadLabelsObject |
Loads a |
loadProjectFile |
Loads given labels file into GUI. |
mergeProject |
Starts gui for importing another dataset into currently one. |
newEdge |
Adds new edge to skeleton. |
newInstance |
Creates a new instance, copying node coordinates as appropriate. |
newNode |
Adds new node to skeleton. |
newProject |
Create a new project in a new window. |
nextLabeledFrame |
Goes to labeled frame after current frame. |
nextSuggestedFrame |
Goes to next suggested frame. |
nextTrackFrame |
Goes to next frame on which a track starts. |
nextUserLabeledFrame |
Goes to next labeled frame with user instances. |
openPrereleaseVersion |
Open the current prerelease version. |
openProject |
Allows user to select and then open a saved project. |
openSkeleton |
Shows gui for loading saved skeleton into project. |
openSkeletonTemplate |
Shows gui for loading saved skeleton into project. |
openStableVersion |
Open the current stable version. |
openWebsite |
Open a website from URL using the native system browser. |
pasteInstance |
Paste the instance from the clipboard as a new copy. |
pasteInstanceTrack |
Pastes the track in the clipboard to the selected instance. |
prevSuggestedFrame |
Goes to previous suggested frame. |
previousLabeledFrame |
Goes to labeled frame prior to current frame. |
removeSuggestion |
Remove the selected frame from suggestions. |
removeVideo |
Removes selected video from project. |
replaceVideo |
Shows gui for replacing videos to project. |
saveProject |
Show gui to save project (or save as if not yet saved). |
saveProjectAs |
Show gui to save project as a new file. |
saveSkeleton |
Shows gui for saving skeleton from project. |
selectToFrame |
Shows gui to go to frame by number. |
setInstancePointVisibility |
Toggles visibility set for a node for an instance. |
setInstanceTrack |
Sets track for selected instance. |
setNodeName |
Changes name of node in skeleton. |
setNodeSymmetry |
Sets node symmetry in skeleton. |
setPointLocations |
Sets locations for node(s) for an instance. |
setTrackName |
Sets name for track. |
showImportVideos |
Show video importer GUI without the file browser. |
signal_update |
Calls the update callback after data has been changed. |
toggleGrayscale |
Toggles grayscale setting for current video. |
transposeInstance |
Transposes tracks for two instances. |
updateEdges |
Called when edges in skeleton have been changed. |
Source code in sleap/gui/commands.py
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 | |
labels
property
¶
Alias to app.labels.
addCurrentFrameAsSuggestion()
¶
Add current frame as a suggestion.
Source code in sleap/gui/commands.py
429 430 431 | |
addTrack()
¶
Creates new track and moves selected instance into this track.
Source code in sleap/gui/commands.py
619 620 621 | |
addUserInstancesFromPredictions()
¶
Create user instance from a predicted instance.
Source code in sleap/gui/commands.py
595 596 597 | |
addVideo()
¶
Shows gui for adding videos to project.
Source code in sleap/gui/commands.py
463 464 465 | |
changestack_clear()
¶
Clears stack of changes.
Source code in sleap/gui/commands.py
288 289 290 291 | |
changestack_push(change='')
¶
Adds to stack of changes made by user.
Source code in sleap/gui/commands.py
274 275 276 277 278 279 280 281 | |
changestack_savepoint()
¶
Marks that project was just saved.
Source code in sleap/gui/commands.py
283 284 285 286 | |
checkForUpdates()
¶
Check for updates online.
Source code in sleap/gui/commands.py
668 669 670 | |
clearSuggestions()
¶
Clear all suggestions.
Source code in sleap/gui/commands.py
437 438 439 | |
completeInstanceNodes(instance)
¶
Adds missing nodes to given instance.
Source code in sleap/gui/commands.py
547 548 549 | |
copyInstance()
¶
Copy the selected instance to the instance clipboard.
Source code in sleap/gui/commands.py
599 600 601 | |
copyInstanceTrack()
¶
Copies the selected instance's track to the track clipboard.
Source code in sleap/gui/commands.py
635 636 637 | |
deleteAreaPredictions()
¶
Gui for deleting instances within some rect on frame images.
Source code in sleap/gui/commands.py
531 532 533 | |
deleteClipPredictions()
¶
Deletes all predictions within selected range of video frames.
Source code in sleap/gui/commands.py
527 528 529 | |
deleteDialog()
¶
Deletes using options selected in a dialog.
Source code in sleap/gui/commands.py
615 616 617 | |
deleteEdge()
¶
Removes (currently selected) edge from skeleton.
Source code in sleap/gui/commands.py
515 516 517 | |
deleteFrameLimitPredictions()
¶
Gui for deleting instances beyond some frame number.
Source code in sleap/gui/commands.py
543 544 545 | |
deleteFramePredictions()
¶
Deletes all predictions on current frame.
Source code in sleap/gui/commands.py
523 524 525 | |
deleteInstanceLimitPredictions()
¶
Gui for deleting instances beyond some number in each frame.
Source code in sleap/gui/commands.py
539 540 541 | |
deleteLowScorePredictions()
¶
Gui for deleting instances below some score threshold.
Source code in sleap/gui/commands.py
535 536 537 | |
deleteMultipleTracks(delete_all=False)
¶
Delete all tracks.
Source code in sleap/gui/commands.py
631 632 633 | |
deleteNode()
¶
Removes (currently selected) node from skeleton.
Source code in sleap/gui/commands.py
495 496 497 | |
deletePredictions()
¶
Deletes all predicted instances in project.
Source code in sleap/gui/commands.py
519 520 521 | |
deleteSelectedInstance()
¶
Deletes currently selected instance.
Source code in sleap/gui/commands.py
607 608 609 | |
deleteSelectedInstanceTrack()
¶
Deletes all instances from track of currently selected instance.
Source code in sleap/gui/commands.py
611 612 613 | |
deleteTrack(track)
¶
Delete a track and remove from all instances.
Source code in sleap/gui/commands.py
627 628 629 | |
execute(command, **kwargs)
¶
Execute command in this context, passing named arguments.
Source code in sleap/gui/commands.py
297 298 299 | |
exportAnalysisFile(all_videos=False)
¶
Shows gui for exporting analysis h5 file.
Source code in sleap/gui/commands.py
375 376 377 | |
exportCSVFile(all_videos=False)
¶
Shows gui for exporting analysis csv file.
Source code in sleap/gui/commands.py
379 380 381 | |
exportFullPackage()
¶
Gui for exporting the dataset with any labeled frames and suggestions.
Source code in sleap/gui/commands.py
399 400 401 | |
exportLabeledClip()
¶
Shows gui for exporting clip with visual annotations.
Source code in sleap/gui/commands.py
387 388 389 | |
exportLabelsSubset(as_package=False, open_new_project=True)
¶
Exports a selected range of video frames and their corresponding labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
as_package
|
bool
|
Whether to export as a package. |
False
|
open_new_project
|
bool
|
Whether to open the exported labels in a new project GUI. |
True
|
Source code in sleap/gui/commands.py
680 681 682 683 684 685 686 687 688 689 690 691 | |
exportNWB()
¶
Show gui for exporting nwb file.
Source code in sleap/gui/commands.py
383 384 385 | |
exportTrainingPackage()
¶
Gui for exporting the dataset with user-labeled images and suggestions.
Source code in sleap/gui/commands.py
395 396 397 | |
exportUserLabelsPackage()
¶
Gui for exporting the dataset with user-labeled images.
Source code in sleap/gui/commands.py
391 392 393 | |
from_labels(labels)
classmethod
¶
Creates a command context for use independently of GUI app.
Source code in sleap/gui/commands.py
256 257 258 259 260 261 262 | |
generateSuggestions(params)
¶
Generates suggestions using given params dictionary.
Source code in sleap/gui/commands.py
660 661 662 | |
gotoFrame()
¶
Shows gui to go to frame by number.
Source code in sleap/gui/commands.py
445 446 447 | |
gotoVideoAndFrame(video, frame_idx)
¶
Activates video and goes to frame.
Source code in sleap/gui/commands.py
453 454 455 | |
importAnalysisFile()
¶
Imports SLEAP analysis hdf5 files.
Source code in sleap/gui/commands.py
363 364 365 | |
importCoco()
¶
Imports COCO datasets.
Source code in sleap/gui/commands.py
351 352 353 | |
importDLC()
¶
Imports DeepLabCut datasets.
Source code in sleap/gui/commands.py
355 356 357 | |
importDLCFolder()
¶
Imports multiple DeepLabCut datasets.
Source code in sleap/gui/commands.py
359 360 361 | |
importNWB()
¶
Imports NWB datasets.
Source code in sleap/gui/commands.py
347 348 349 | |
lastInteractedFrame()
¶
Goes to last frame that user interacted with.
Source code in sleap/gui/commands.py
417 418 419 | |
loadLabelsObject(labels, filename=None)
¶
Loads a Labels object into the GUI, replacing any currently loaded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
Labels
|
The |
required |
filename
|
Optional[str]
|
The filename where this file is saved, if any. |
None
|
Returns:
| Type | Description |
|---|---|
|
None. |
Source code in sleap/gui/commands.py
307 308 309 310 311 312 313 314 315 316 317 318 | |
loadProjectFile(filename)
¶
Loads given labels file into GUI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
Union[str, Labels]
|
The path to the saved labels dataset or the |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in sleap/gui/commands.py
320 321 322 323 324 325 326 327 328 329 330 | |
mergeProject(filenames=None)
¶
Starts gui for importing another dataset into currently one.
Source code in sleap/gui/commands.py
656 657 658 | |
newEdge(src_node, dst_node)
¶
Adds new edge to skeleton.
Source code in sleap/gui/commands.py
511 512 513 | |
newInstance(copy_instance=None, init_method='best', location=None, mark_complete=False, offset=0)
¶
Creates a new instance, copying node coordinates as appropriate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
copy_instance
|
Optional[Instance]
|
The :class: |
None
|
init_method
|
str
|
Method to use for positioning nodes. |
'best'
|
location
|
Optional[QPoint]
|
The location where instance should be added (if node init method supports custom location). |
None
|
mark_complete
|
bool
|
Whether to mark the instance as complete. |
False
|
offset
|
int
|
Offset to apply to the location if given. |
0
|
Source code in sleap/gui/commands.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 576 577 | |
newNode()
¶
Adds new node to skeleton.
Source code in sleap/gui/commands.py
491 492 493 | |
newProject()
¶
Create a new project in a new window.
Source code in sleap/gui/commands.py
303 304 305 | |
nextLabeledFrame()
¶
Goes to labeled frame after current frame.
Source code in sleap/gui/commands.py
409 410 411 | |
nextSuggestedFrame()
¶
Goes to next suggested frame.
Source code in sleap/gui/commands.py
421 422 423 | |
nextTrackFrame()
¶
Goes to next frame on which a track starts.
Source code in sleap/gui/commands.py
441 442 443 | |
nextUserLabeledFrame()
¶
Goes to next labeled frame with user instances.
Source code in sleap/gui/commands.py
413 414 415 | |
openPrereleaseVersion()
¶
Open the current prerelease version.
Source code in sleap/gui/commands.py
676 677 678 | |
openProject(filename=None, first_open=False)
¶
Allows user to select and then open a saved project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
Optional[str]
|
Filename of the project to be opened. If None, a file browser dialog will prompt the user for a path. |
None
|
first_open
|
bool
|
Whether this is the first window opened. If True, then the new project is loaded into the current window rather than a new application window. |
False
|
Returns:
| Type | Description |
|---|---|
|
None. |
Source code in sleap/gui/commands.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
openSkeleton()
¶
Shows gui for loading saved skeleton into project.
Source code in sleap/gui/commands.py
483 484 485 | |
openSkeletonTemplate()
¶
Shows gui for loading saved skeleton into project.
Source code in sleap/gui/commands.py
479 480 481 | |
openStableVersion()
¶
Open the current stable version.
Source code in sleap/gui/commands.py
672 673 674 | |
openWebsite(url)
¶
Open a website from URL using the native system browser.
Source code in sleap/gui/commands.py
664 665 666 | |
pasteInstance()
¶
Paste the instance from the clipboard as a new copy.
Source code in sleap/gui/commands.py
603 604 605 | |
pasteInstanceTrack()
¶
Pastes the track in the clipboard to the selected instance.
Source code in sleap/gui/commands.py
639 640 641 | |
prevSuggestedFrame()
¶
Goes to previous suggested frame.
Source code in sleap/gui/commands.py
425 426 427 | |
previousLabeledFrame()
¶
Goes to labeled frame prior to current frame.
Source code in sleap/gui/commands.py
405 406 407 | |
removeSuggestion()
¶
Remove the selected frame from suggestions.
Source code in sleap/gui/commands.py
433 434 435 | |
removeVideo()
¶
Removes selected video from project.
Source code in sleap/gui/commands.py
475 476 477 | |
replaceVideo()
¶
Shows gui for replacing videos to project.
Source code in sleap/gui/commands.py
471 472 473 | |
saveProject()
¶
Show gui to save project (or save as if not yet saved).
Source code in sleap/gui/commands.py
367 368 369 | |
saveProjectAs()
¶
Show gui to save project as a new file.
Source code in sleap/gui/commands.py
371 372 373 | |
saveSkeleton()
¶
Shows gui for saving skeleton from project.
Source code in sleap/gui/commands.py
487 488 489 | |
selectToFrame()
¶
Shows gui to go to frame by number.
Source code in sleap/gui/commands.py
449 450 451 | |
setInstancePointVisibility(instance, node, visible)
¶
Toggles visibility set for a node for an instance.
Source code in sleap/gui/commands.py
589 590 591 592 593 | |
setInstanceTrack(new_track)
¶
Sets track for selected instance.
Source code in sleap/gui/commands.py
623 624 625 | |
setNodeName(skeleton, node, name)
¶
Changes name of node in skeleton.
Source code in sleap/gui/commands.py
499 500 501 | |
setNodeSymmetry(skeleton, node, symmetry)
¶
Sets node symmetry in skeleton.
Source code in sleap/gui/commands.py
503 504 505 | |
setPointLocations(instance, nodes_locations)
¶
Sets locations for node(s) for an instance.
Source code in sleap/gui/commands.py
579 580 581 582 583 584 585 586 587 | |
setTrackName(track, name)
¶
Sets name for track.
Source code in sleap/gui/commands.py
643 644 645 | |
showImportVideos(filenames)
¶
Show video importer GUI without the file browser.
Source code in sleap/gui/commands.py
467 468 469 | |
signal_update(what)
¶
Calls the update callback after data has been changed.
Source code in sleap/gui/commands.py
269 270 271 272 | |
toggleGrayscale()
¶
Toggles grayscale setting for current video.
Source code in sleap/gui/commands.py
459 460 461 | |
transposeInstance()
¶
Transposes tracks for two instances.
If there are only two instances, then this swaps tracks. Otherwise, it allows user to select the instances for which we want to swap tracks.
Source code in sleap/gui/commands.py
647 648 649 650 651 652 653 654 | |
updateEdges()
¶
Called when edges in skeleton have been changed.
Source code in sleap/gui/commands.py
507 508 509 | |
DeleteFrameLimitPredictions
¶
Bases: InstanceDeleteCommand
Methods:
| Name | Description |
|---|---|
get_frame_instance_list |
Called from the parent |
Source code in sleap/gui/commands.py
2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 | |
get_frame_instance_list(context, params)
staticmethod
¶
Called from the parent InstanceDeleteCommand.ask method.
Returns:
| Type | Description |
|---|---|
|
List of instances to be deleted. |
Source code in sleap/gui/commands.py
2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 | |
DeleteMultipleTracks
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
do_action |
Delete either all tracks or just unused tracks. |
Source code in sleap/gui/commands.py
3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 | |
do_action(context, params)
staticmethod
¶
Delete either all tracks or just unused tracks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The command parameters. delete_all: If True, delete all tracks. If False, delete only unused tracks. |
required |
Source code in sleap/gui/commands.py
3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 | |
EditCommand
¶
Bases: AppCommand
Class for commands which change data in project.
Source code in sleap/gui/commands.py
2035 2036 2037 2038 | |
ExportLabeledClip
¶
Bases: ExportVideoClip
Export a labeled video clip with labels and edges.
This command is used to export a labeled video clip with labels and edges. It
inherits from the ExportVideoClip class and provides additional functionality for
exporting labeled videos.
Methods:
| Name | Description |
|---|---|
ask |
Ask the user for parameters to export a labeled video clip. |
write_new_video |
Write a new annotated video using the parameters provided. |
Source code in sleap/gui/commands.py
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | |
ask(context, params)
classmethod
¶
Ask the user for parameters to export a labeled video clip.
Source code in sleap/gui/commands.py
1496 1497 1498 1499 1500 1501 | |
write_new_video(context, params)
classmethod
¶
Write a new annotated video using the parameters provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
The command context. |
required | |
params
|
The parameters for the export. |
required |
Source code in sleap/gui/commands.py
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | |
ExportLabelsSubset
¶
Bases: ExportFullPackage
Export a subset of labels to a new file with either images or a trimmed video.
This command subclasses ExportFullPackage, but uses also uses methods from
ExportVideoClip to provide functionality for exporting a subset of labels to a new
file with either images or a trimmed video. It allows the user to specify the labels
to export and the format of the output file.
Methods:
| Name | Description |
|---|---|
get_labels_subset_unshifted |
Get the labels subset for the export. |
get_lfs_subset |
Get the labeled frames subset for the export. |
get_or_create_video_subset |
Get the video subset for the export. |
get_suggestions_subset |
Get the suggestions subset for the labels. |
Source code in sleap/gui/commands.py
1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | |
get_labels_subset_unshifted(context, params)
classmethod
¶
Get the labels subset for the export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Labels |
Labels
|
The labels subset for the export. |
Source code in sleap/gui/commands.py
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 | |
get_lfs_subset(labels_subset_unshifted, video_subset, params)
classmethod
¶
Get the labeled frames subset for the export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels_subset_unshifted
|
Labels
|
The labels subset to export. |
required |
video_subset
|
Video
|
The video subset to export. |
required |
params
|
dict
|
The parameters for the export. |
required |
Returns:
| Type | Description |
|---|---|
list[LabeledFrame]
|
list[LabeledFrame]: The labeled frames subset for the export. |
Source code in sleap/gui/commands.py
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | |
get_or_create_video_subset(context, params)
classmethod
¶
Get the video subset for the export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Video |
Video
|
The video subset for the export. |
Source code in sleap/gui/commands.py
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 | |
get_suggestions_subset(labels_subset_unshifted, video_subset, params)
classmethod
¶
Get the suggestions subset for the labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels_subset_unshifted
|
Labels
|
The labels subset to export. |
required |
video_subset
|
Video
|
The video subset to export. |
required |
Returns:
| Type | Description |
|---|---|
list[SuggestionFrame]
|
list[SuggestionFrame]: The suggestions subset for the labels. |
Source code in sleap/gui/commands.py
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | |
ExportVideoClip
¶
Bases: AppCommand
Base class for exporting video clips.
The ask method provides all functionality to gather parameters from the export dialog.
Methods:
| Name | Description |
|---|---|
ask |
Ask the user for parameters to export a video clip. |
do_action |
Export video clip using the parameters provided. |
get_export_options |
Get export options from the user. |
get_frame_range_params |
Get frame range parameters. |
get_video_augmentation_params |
Get video augmentation parameters. |
get_video_markup_params |
Get video markup parameters. |
get_video_save_params |
Get video save parameters. |
write_new_video |
Write a new video using the parameters provided. |
Source code in sleap/gui/commands.py
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 | |
ask(context, params)
classmethod
¶
Ask the user for parameters to export a video clip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the user provided valid parameters, False otherwise. |
Source code in sleap/gui/commands.py
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | |
do_action(context, params)
classmethod
¶
Export video clip using the parameters provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Source code in sleap/gui/commands.py
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 | |
get_export_options(context, params)
classmethod
¶
Get export options from the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict | None
|
The export options. |
Source code in sleap/gui/commands.py
1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 | |
get_frame_range_params(context, params)
classmethod
¶
Get frame range parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Side Effects
Sets "frames" in params.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Containing the frame range parameters (in addition to other params). |
Source code in sleap/gui/commands.py
1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | |
get_video_augmentation_params(context, params, export_options)
classmethod
¶
Get video augmentation parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
export_options
|
dict
|
The export options. |
required |
Side Effects
Sets "scale", "background", and "crop" in params.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Containing the video augmentation parameters (in addition to other params). |
Source code in sleap/gui/commands.py
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | |
get_video_markup_params(context, params, export_options)
classmethod
¶
Get video markup parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
export_options
|
dict
|
The export options. |
required |
Side Effects
Sets "color_manager", "show edges", "edge_is_wedge", and "marker size" in params.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Containing the video markup parameters (in addition to other params). |
Source code in sleap/gui/commands.py
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 | |
get_video_save_params(params, export_options)
classmethod
¶
Get video save parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict
|
The parameters for the export. |
required |
export_options
|
dict
|
The export options. |
required |
Side Effects
Sets "video_filename", "fps", and "open_when_done" in params.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Containing the video save parameters (in addition to other params). |
Source code in sleap/gui/commands.py
1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | |
write_new_video(context, params)
classmethod
¶
Write a new video using the parameters provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The command context. |
required |
params
|
dict
|
The parameters for the export. |
required |
Source code in sleap/gui/commands.py
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 | |
FakeApp
¶
Use if you want to execute commands independently of the GUI app.
Source code in sleap/gui/commands.py
226 227 228 229 230 | |
GoIteratorCommand
¶
Bases: AppCommand
Source code in sleap/gui/commands.py
1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 | |
InstanceDeleteCommand
¶
Bases: EditCommand
Source code in sleap/gui/commands.py
2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 | |
LoadLabelsObject
¶
Bases: AppCommand
Methods:
| Name | Description |
|---|---|
do_action |
Loads a |
Source code in sleap/gui/commands.py
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 | |
do_action(context, params)
staticmethod
¶
Loads a Labels object into the GUI, replacing any currently loaded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
The |
required | |
filename
|
The filename where this file is saved, if any. |
required |
Returns:
| Type | Description |
|---|---|
|
None. |
Source code in sleap/gui/commands.py
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 | |
OpenSkeleton
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
do_action |
Replace skeleton with new skeleton. |
get_template_skeleton_filename |
Helper function to get the template skeleton filename from dropdown. |
Source code in sleap/gui/commands.py
2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 | |
do_action(context, params)
staticmethod
¶
Replace skeleton with new skeleton.
Note that we modify the existing skeleton in-place to essentially match the new
skeleton. However, we cannot rename the skeleton since Skeleton.name is used
for hashing (see Skeleton.name setter).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
CommandContext |
required |
params
|
dict
|
dict filename: str delete_nodes: List[str] add_nodes: List[str] linked_nodes: Dict[str, str] |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in sleap/gui/commands.py
2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 | |
get_template_skeleton_filename(context)
staticmethod
¶
Helper function to get the template skeleton filename from dropdown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
CommandContext
|
The |
required |
Returns:
| Type | Description |
|---|---|
str
|
Path to the template skeleton shipped with SLEAP. |
Source code in sleap/gui/commands.py
2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 | |
ReplaceVideo
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
ask |
Shows gui for replacing videos in project. |
Source code in sleap/gui/commands.py
2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | |
ask(context, params)
staticmethod
¶
Shows gui for replacing videos in project.
Source code in sleap/gui/commands.py
2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | |
SaveProjectAs
¶
Bases: AppCommand
Source code in sleap/gui/commands.py
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 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
SetInstancePointLocations
¶
Bases: EditCommand
Sets locations for node(s) for an instance.
Note: It's important that this command does not update the visual scene, since this would redraw the frame and create new visual objects. The calling code is responsible for updating the visual scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
The instance |
required | |
nodes_locations
|
A dictionary of data to set |
required |
Source code in sleap/gui/commands.py
3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 | |
SetInstancePointVisibility
¶
Bases: EditCommand
Toggles visibility set for a node for an instance.
Note: It's important that this command does not update the visual scene, since this would redraw the frame and create new visual objects. The calling code is responsible for updating the visual scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
The instance |
required | |
node
|
The |
required | |
visible
|
Whether to set or clear visibility for node |
required |
Source code in sleap/gui/commands.py
3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 | |
ToggleGrayscale
¶
Bases: EditCommand
Methods:
| Name | Description |
|---|---|
do_action |
Reset the video backend. |
Source code in sleap/gui/commands.py
2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 | |
do_action(context, params)
staticmethod
¶
Reset the video backend.
Source code in sleap/gui/commands.py
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 | |
UpdateTopic
¶
Bases: Enum
Topics so context can tell callback what was updated by the command.
Source code in sleap/gui/commands.py
128 129 130 131 132 133 134 135 136 137 138 139 140 | |
copy_to_clipboard(text)
¶
Copy a string to the system clipboard. Args: text: String to copy to clipboard.
Source code in sleap/gui/commands.py
4004 4005 4006 4007 4008 4009 4010 4011 | |
export_dataset_gui(labels, filename, all_labeled=False, suggested=False, verbose=True, as_package=True)
¶
Export dataset with image data and display progress GUI dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
Labels
|
|
required |
filename
|
str
|
Output filename. Should end in |
required |
all_labeled
|
bool
|
If |
False
|
suggested
|
bool
|
If |
False
|
verbose
|
bool
|
If |
True
|
as_package
|
bool
|
If |
True
|
Source code in sleap/gui/commands.py
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | |
get_new_version_filename(filename)
¶
Increment version number in filenames that end in .v###.slp.
Source code in sleap/gui/commands.py
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | |
open_file(filename)
¶
Opens file in native system file browser or registered application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to file or folder. |
required |
Notes
Source code in sleap/gui/commands.py
1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | |
open_website(url)
¶
Open website in default browser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to open. |
required |
Source code in sleap/gui/commands.py
3956 3957 3958 3959 3960 3961 3962 | |