Closed cor2ni closed 2 months ago
Hello,
Can you please specify what exactly is in the config dictionary to reproduce the issue?
Bests,
Yes, the config dictionary contains these values: (config_path = pathlib.Path('/yyy/deeperhistreg/deeperhistreg_params/default_nonrigid.json') registration_params = deeperhistreg.configs.load_parameters(config_path)
config = {'source_path': PosixPath('/xxx/Experiments/file1.png'), 'target_path': PosixPath('/xxx/Experiments/file2.png'), 'output_path': PosixPath('/xxx/Experiments/Results'), 'registration_parameters': {'device': 'cuda:0', 'echo': False, 'save_final_images': True, 'save_final_displacement_field': True, 'case_name': 'Default_Nonrigid', 'logging_path': None, 'loading_params': {'final_level': 0, 'pad_value': 255.0, 'loader': 'pil', 'source_resample_ratio': 0.2, 'target_resample_ratio': 0.2}, 'saving_params': {'saver': 'pil', 'final_saver': 'tiff', 'save_params': 'pil', 'extension': '.jpg', 'final_extension': '.tiff'}, 'preprocessing_params': {'preprocessing_function': 'basic_preprocessing', 'initial_resampling': True, 'initial_resolution': 4096, 'normalization': True, 'convert_to_gray': True, 'clahe': True, 'save_results': True, 'flip_intensity': True}, 'run_initial_registration': True, 'initial_registration_params': {'save_results': True, 'initial_registration_function': 'identity_initial_alignment'}, 'run_nonrigid_registration': True, 'nonrigid_registration_params': {'save_results': True, 'nonrigid_registration_function': 'instance_optimization_nonrigid_registration', 'device': 'cuda:0', 'echo': False, 'cost_function': 'ncc_local', 'cost_function_params': {'win_size': 7}, 'regularization_function': 'diffusion_relative', 'regularization_function_params': {}, 'registration_size': 4096, 'num_levels': 8, 'used_levels': 8, 'iterations': [100, 100, 100, 100, 100, 100, 100, 200], 'learning_rates': [0.005, 0.0025, 0.0025, 0.0025, 0.0025, 0.0025, 0.0025, 0.0015], 'alphas': [1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.8]}}, 'case_name': 'file1_file2', 'save_displacement_field': True, 'copy_target': True, 'delete_temporary_results': False, 'temporary_path': PosixPath('/xxx/Experiments/Results/file1_file2_TEMP')}
I also tried this way: registration_params : dict = default_initial_nonrigid() The config dictionary is comparable except of this part: ...'run_initial_registration': True, 'initial_registration_params': {'save_results': True, 'initial_registration_function': 'multi_feature', 'registration_size': 620, 'registration_sizes': [150, 200, 250, 300, 350, 400, 450, 500], 'transform_type': 'rigid', 'keypoint_threshold': 0.005, 'match_threshold': 0.3, 'sinkhorn_iterations': 50, 'show': False, 'angle_step': 90, 'cuda': True, 'device': 'cuda:0', 'echo': False, 'run_sift_ransac': True, 'run_superpoint_superglue': True, 'run_superpoint_ransac': False}, 'run_nonrigid_registration': True,...
I attempted to reproduce the problem, however, the registration completed successfully.
1) Could you please specify your hardware specifications? I suspect that there may be problems related to the available GPU memory. You can verify that by decreasing the 'registration_size' parameter in the nonrigid configuration. 2) Were the results produced by the initial alignment saved successfully?
Thank you for trying it and the hint with the GPU! I tested the code on another computer with Ubuntu 22.04 and nvidia GPU, installed a new GPU driver there and the code completed successfully.
To answer your questions about the error on the first device:
I will stick to the Ubuntu computer then for this task. Thank you for your efforts!
Thank you for the feedback. Generally, the framework should work using CPU-only configuration (however, the config has to be changed) but the registration process will be much slower (especially the nonrigid one). However, the Windows is currently not directly supported and there may be errors (mostly connected with PyVips and OpenSlide).
Hi, I try to register two histology slides (both png files) with wsl and installed the deeperhistreg pip package. When I run code from the jupyter notebook or the bash application 'run_registration.sh', the same error occurs: Source shape: (3424, 4615, 3) Target shape: (3529, 3659, 3) Traceback (most recent call last): File "/xxx/deeperhistreg_jupyter.py", line 68, in
deeperhistreg.run_registration(**config)
File "/yyy/run.py", line 50, in run_registration
warped_name = [item for item in os.listdir(pathlib.Path(save_path) / experiment_name / "Results_Final") if "warped_source" in item][0]
FileNotFoundError: [Errno 2] No such file or directory: '/zzz/Results/file1_file2_TEMP/file1_file2/Results_Final'
The Preprocessing folder and the Initial_Registration folder were successfully created. The logfile in the TEMP-folder states that Image loading, Preprocessing and Initial alignment are saved. 'Initial alignment saved.' is the last output there. How can I proceed with the nonrigid registration to get the final results or what else should I consider? Thank you in advance!