-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
572bd19
commit 65916f9
Showing
2 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
def run_big_stitcher(): | ||
return | ||
import subprocess | ||
from pathlib import Path | ||
|
||
XML_PATH = ( | ||
"D:/TiledDataset/2.5x_tile/" | ||
"2.5x_tile_igor_rightonly_Mag2.5x_ch488_ch561_ch647_bdv3.xml" | ||
) | ||
TILE_CONFIG_PATH = ( | ||
"D:/TiledDataset/" | ||
"2.5x_tile/" | ||
"2.5x_tile_igor_rightonly_Mag2.5x" | ||
"_ch488_ch561_ch647_bdv_tile_config.txt" | ||
) | ||
|
||
|
||
def run_big_stitcher( | ||
imageJ_path: Path, xml_path: Path, tile_config_path: Path | ||
): | ||
stitch_macro_path = Path(__file__).resolve().parent / "stitch_macro.ijm" | ||
command = ( | ||
f"{imageJ_path} --ij2" | ||
f" --headless -macro {stitch_macro_path} " | ||
f'"{xml_path} {tile_config_path}"' | ||
) | ||
|
||
result = subprocess.run( | ||
command, capture_output=True, text=True, check=True | ||
) | ||
|
||
return result | ||
|
||
|
||
if __name__ == "__main__": | ||
result = run_big_stitcher( | ||
Path("C:/Users/Igor/Documents/Fiji.app/ImageJ-win64.exe"), | ||
Path(XML_PATH), | ||
Path(TILE_CONFIG_PATH), | ||
) | ||
|
||
with open("big_stitcher_output.txt", "w") as f: | ||
f.write(result.stdout) | ||
f.write(result.stderr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
args = getArgument() | ||
args = split(args, " ") | ||
xmlPath = args[0] | ||
args = getArgument(); | ||
args = split(args, " "); | ||
xmlPath = args[0]; | ||
tilePath = args[1] | ||
|
||
print("Stitching " + xmlPath); | ||
print("Loading TileConfiguration from " + tilePath) | ||
run("Load TileConfiguration from File...", | ||
"browse=" + xmlPath + | ||
" select=" + xmlPath + | ||
" tileconfiguration=" + tilePath + | ||
" use_pixel_units keep_metadata_rotation"); | ||
|
||
print("Calculating pairwise shifts"); | ||
run("Calculate pairwise shifts ...", | ||
"select=" + xmlPath + | ||
" process_angle=[All angles] process_channel=[All channels] process_illumination=[All illuminations]" + | ||
" process_tile=[All tiles] process_timepoint=[All Timepoints]" + | ||
" method=[Phase Correlation] channels=[Average Channels]" + | ||
" downsample_in_x=4 downsample_in_y=4 downsample_in_z=4"); | ||
|
||
print("Optimizing globally and applying shifts") | ||
run("Optimize globally and apply shifts ...", | ||
"select=" + xmlPath + | ||
" process_angle=[All angles] process_channel=[All channels] process_illumination=[All illuminations]" + | ||
" process_tile=[All tiles] process_timepoint=[All Timepoints] relative=2.500 absolute=3.500" + | ||
" global_optimization_strategy=[Two-Round using Metadata to align unconnected Tiles and iterative dropping of bad links]" + | ||
" fix_group_0-0,"); | ||
|
||
print("Done"); | ||
eval("script", "System.exit(0);"); |