Spaces:
Sleeping
Sleeping
Sync from GitHub Actions (skip png)
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from PIL import Image
|
|
| 3 |
import tifffile
|
| 4 |
import tempfile
|
| 5 |
import os
|
| 6 |
-
from typing import Optional
|
| 7 |
|
| 8 |
from core.utils import (
|
| 9 |
WORK_DIR, DEMO_DIR, upscale, load_stack,
|
|
@@ -18,6 +18,14 @@ from core.registration import (
|
|
| 18 |
_resolve_path,
|
| 19 |
)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
_start_cleaner()
|
| 22 |
|
| 23 |
def _stage_for_backend(src: str) -> str:
|
|
@@ -368,7 +376,7 @@ with gr.Blocks() as demo:
|
|
| 368 |
def _mcp_align_stack_to_reference(
|
| 369 |
stack_file: str,
|
| 370 |
reference_index: int = 0,
|
| 371 |
-
mode:
|
| 372 |
external_reference_file: Optional[str] = None,
|
| 373 |
external_reference_index: int = 0,
|
| 374 |
) -> gr.FileData:
|
|
@@ -402,7 +410,7 @@ with gr.Blocks() as demo:
|
|
| 402 |
def _mcp_align_stack_to_stack(
|
| 403 |
reference_stack_file: str,
|
| 404 |
moving_stack_file: str,
|
| 405 |
-
mode:
|
| 406 |
) -> gr.FileData:
|
| 407 |
"""Align every frame in a moving TIFF stack to the first frame of a reference stack.
|
| 408 |
|
|
@@ -424,7 +432,7 @@ with gr.Blocks() as demo:
|
|
| 424 |
stack_file: str,
|
| 425 |
reference_index: int,
|
| 426 |
moving_index: int,
|
| 427 |
-
mode:
|
| 428 |
) -> gr.FileData:
|
| 429 |
"""Align a single moving frame to a reference frame within the same TIFF stack.
|
| 430 |
|
|
|
|
| 3 |
import tifffile
|
| 4 |
import tempfile
|
| 5 |
import os
|
| 6 |
+
from typing import Optional, Literal
|
| 7 |
|
| 8 |
from core.utils import (
|
| 9 |
WORK_DIR, DEMO_DIR, upscale, load_stack,
|
|
|
|
| 18 |
_resolve_path,
|
| 19 |
)
|
| 20 |
|
| 21 |
+
TransformationMode = Literal[
|
| 22 |
+
"TRANSLATION",
|
| 23 |
+
"RIGID_BODY",
|
| 24 |
+
"SCALED_ROTATION",
|
| 25 |
+
"AFFINE",
|
| 26 |
+
"BILINEAR",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
_start_cleaner()
|
| 30 |
|
| 31 |
def _stage_for_backend(src: str) -> str:
|
|
|
|
| 376 |
def _mcp_align_stack_to_reference(
|
| 377 |
stack_file: str,
|
| 378 |
reference_index: int = 0,
|
| 379 |
+
mode: TransformationMode = "RIGID_BODY",
|
| 380 |
external_reference_file: Optional[str] = None,
|
| 381 |
external_reference_index: int = 0,
|
| 382 |
) -> gr.FileData:
|
|
|
|
| 410 |
def _mcp_align_stack_to_stack(
|
| 411 |
reference_stack_file: str,
|
| 412 |
moving_stack_file: str,
|
| 413 |
+
mode: TransformationMode = "RIGID_BODY",
|
| 414 |
) -> gr.FileData:
|
| 415 |
"""Align every frame in a moving TIFF stack to the first frame of a reference stack.
|
| 416 |
|
|
|
|
| 432 |
stack_file: str,
|
| 433 |
reference_index: int,
|
| 434 |
moving_index: int,
|
| 435 |
+
mode: TransformationMode = "RIGID_BODY",
|
| 436 |
) -> gr.FileData:
|
| 437 |
"""Align a single moving frame to a reference frame within the same TIFF stack.
|
| 438 |
|