Hello!
The new version is working great performance-wise compared with the previous version. Just a couple of issues hopefully are easy fixes. Running the latest Docker image on Windows 10 Ubuntu 22.04.3 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64). I tested with two 4-channel cycles from multiplex run and using the following script, the file size was 8,897,156KB. Resaving as .tif from FIJI the size was 1,480,200KB. Opening the .ome.tiff in FIJI there were two series although I used pyramid=False when writing. Is there a way to ensure a minimal file size and only one series writes? Beside the file size/pyramiding, the other minor issue is the channel_name_dict is being ignored. The channel names being written are sequential integers followed by the original input folder name (not original file names). The input tiffs did have channel names including dapi for channel 0, but there were not recognized.
import valis
from valis import valtils
from valis import registration
from valis import slide_io
from valis.micro_rigid_registrar import MicroRigidRegistrar
import time
import os
import numpy as np
valis.slide_io.init_jvm(jar=None, mem_gb=50)
slide_src_dir = "/home/smith6jt/VALIS_in"
results_dst_dir = "/home/smith6jt/VALIS_out"
merged_slide_dst_f = "/home/smith6jt/VALIS_out/20_6_SP_CC2C.ome.tiff"
path_to_registrar = "/home/smith6jt/VALIS_out/VALIS_in/data/VALIS_in_registrar.pickle"
micro_reg_fraction = 0.25
registrar = registration.Valis(slide_src_dir, results_dst_dir, micro_rigid_registrar_cls=MicroRigidRegistrar)
rigid_registrar, non_rigid_registrar, error_df = registrar.register()
Calculate what max_non_rigid_registration_dim_px needs to be to do non-rigid registration on an image that is 25% full resolution.
img_dims = np.array([slide_obj.slide_dimensions_wh[0] for slide_obj in registrar.slide_dict.values()])
min_max_size = np.min([np.max(d) for d in img_dims])
img_areas = [np.multiply(d) for d in img_dims]
max_img_w, max_img_h = tuple(img_dims[np.argmax(img_areas)])
micro_reg_size = np.floor(min_max_sizemicro_reg_fraction).astype(int)
Perform high resolution non-rigid registration using 25% full resolution
micro_reg, micro_error = registrar.register_micro(max_non_rigid_registration_dim_px=micro_reg_size)
channel_name_dict = {"cyc01.tif" : ["DAPI", "Blank1a", "Blank1b", "Blank1c"],
"cyc02.tif" : ["DAPI", "CD31", "CD8", "Empty2c"]}
"cyc03.tif" : ["DAPI", "CD20", "Ki67", "CD3e"],
"cyc04.tif" : ["DAPI", "SMActin", "Podoplanin", "CD68"],
"cyc05.tif" : ["DAPI", "PanCK", "CD21", "CD4"],
"cyc06.tif" : ["DAPI", "Lyve1", "CD45RO", "CD11c"],
"cyc07.tif" : ["DAPI", "CD35", "ECAD", "CD107a"],
"cyc08.tif" : ["DAPI", "CD34", "CD44", "HLADR"],
"cyc09.tif" : ["DAPI", "Empty9a", "FoxP3", "CD163"],
"cyc10.tif" : ["DAPI", "Empty10a", "CollagenIV", "Vimentin"],
"cyc11.tif" : ["DAPI", "Empty11a", "CD15", "CD45"],
"cyc12.tif" : ["DAPI", "Empty12a", "CD5", "CD1c"],
"cyc13.tif" : ["DAPI", "Blank13a", "Blank13b", "Blank13c"]}
"cyc014_Z="+pos+".tif" : ["DAPI", "Empty14", "CD45RA", "Empty14b"],
"cyc015_Z="+pos+".tif" : ["DAPI", "Blank15a", "Blank15b", "Blank15c"]}
registrar = registration.load_registrar(path_to_registrar)
merged_img, channel_names, ome_xml =
registrar.warp_and_merge_slides(
merged_slide_dst_f,
channel_name_dict=channel_name_dict,
pyramid=False,
drop_duplicates=False,
crop="overlap")
registration.kill_jvm() # Kill the JVM
These are the images that ended up working. At first, I saved merged channels after deconvolution and extended depth of field processing using a FIJI macro, but got AttributeError: 'NoneType' object has no attribute 'doubleValue' and UnboundLocalError: local variable 'slide_reader_cls' referenced before assignment. To fix this, I resaved after splitting channels and saving as a stack.
https://drive.google.com/drive/folders/19SfyorAqbGGMRFeoE-v50dx8hOreFQAe?usp=sharing
Thank you for all your hard work!
Hello!
The new version is working great performance-wise compared with the previous version. Just a couple of issues hopefully are easy fixes. Running the latest Docker image on Windows 10 Ubuntu 22.04.3 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64). I tested with two 4-channel cycles from multiplex run and using the following script, the file size was 8,897,156KB. Resaving as .tif from FIJI the size was 1,480,200KB. Opening the .ome.tiff in FIJI there were two series although I used pyramid=False when writing. Is there a way to ensure a minimal file size and only one series writes? Beside the file size/pyramiding, the other minor issue is the channel_name_dict is being ignored. The channel names being written are sequential integers followed by the original input folder name (not original file names). The input tiffs did have channel names including dapi for channel 0, but there were not recognized.
import valis
from valis import valtils
from valis import registration
from valis import slide_io
from valis.micro_rigid_registrar import MicroRigidRegistrar
import time
import os
import numpy as np
valis.slide_io.init_jvm(jar=None, mem_gb=50)
slide_src_dir = "/home/smith6jt/VALIS_in"
results_dst_dir = "/home/smith6jt/VALIS_out"
merged_slide_dst_f = "/home/smith6jt/VALIS_out/20_6_SP_CC2C.ome.tiff"
path_to_registrar = "/home/smith6jt/VALIS_out/VALIS_in/data/VALIS_in_registrar.pickle"
micro_reg_fraction = 0.25
registrar = registration.Valis(slide_src_dir, results_dst_dir, micro_rigid_registrar_cls=MicroRigidRegistrar)
rigid_registrar, non_rigid_registrar, error_df = registrar.register()
Calculate what
max_non_rigid_registration_dim_pxneeds to be to do non-rigid registration on an image that is 25% full resolution.img_dims = np.array([slide_obj.slide_dimensions_wh[0] for slide_obj in registrar.slide_dict.values()])
min_max_size = np.min([np.max(d) for d in img_dims])
img_areas = [np.multiply(d) for d in img_dims]
max_img_w, max_img_h = tuple(img_dims[np.argmax(img_areas)])
micro_reg_size = np.floor(min_max_sizemicro_reg_fraction).astype(int)
Perform high resolution non-rigid registration using 25% full resolution
micro_reg, micro_error = registrar.register_micro(max_non_rigid_registration_dim_px=micro_reg_size)
channel_name_dict = {"cyc01.tif" : ["DAPI", "Blank1a", "Blank1b", "Blank1c"],
"cyc02.tif" : ["DAPI", "CD31", "CD8", "Empty2c"]}
"cyc03.tif" : ["DAPI", "CD20", "Ki67", "CD3e"],
"cyc04.tif" : ["DAPI", "SMActin", "Podoplanin", "CD68"],
"cyc05.tif" : ["DAPI", "PanCK", "CD21", "CD4"],
"cyc06.tif" : ["DAPI", "Lyve1", "CD45RO", "CD11c"],
"cyc07.tif" : ["DAPI", "CD35", "ECAD", "CD107a"],
"cyc08.tif" : ["DAPI", "CD34", "CD44", "HLADR"],
"cyc09.tif" : ["DAPI", "Empty9a", "FoxP3", "CD163"],
"cyc10.tif" : ["DAPI", "Empty10a", "CollagenIV", "Vimentin"],
"cyc11.tif" : ["DAPI", "Empty11a", "CD15", "CD45"],
"cyc12.tif" : ["DAPI", "Empty12a", "CD5", "CD1c"],
"cyc13.tif" : ["DAPI", "Blank13a", "Blank13b", "Blank13c"]}
"cyc014_Z="+pos+".tif" : ["DAPI", "Empty14", "CD45RA", "Empty14b"],
"cyc015_Z="+pos+".tif" : ["DAPI", "Blank15a", "Blank15b", "Blank15c"]}
registrar = registration.load_registrar(path_to_registrar)
merged_img, channel_names, ome_xml =
registrar.warp_and_merge_slides(
merged_slide_dst_f,
channel_name_dict=channel_name_dict,
pyramid=False,
drop_duplicates=False,
crop="overlap")
registration.kill_jvm() # Kill the JVM
These are the images that ended up working. At first, I saved merged channels after deconvolution and extended depth of field processing using a FIJI macro, but got AttributeError: 'NoneType' object has no attribute 'doubleValue' and UnboundLocalError: local variable 'slide_reader_cls' referenced before assignment. To fix this, I resaved after splitting channels and saving as a stack.
https://drive.google.com/drive/folders/19SfyorAqbGGMRFeoE-v50dx8hOreFQAe?usp=sharing
Thank you for all your hard work!