Closed bweasels closed 2 years ago
spacing: [0.100488, 0.100488, 0.967742]
is the spacing to 6 decimal digits. Could you check your files and see whether the spacing differs in some less significant decimal place (tenth, 15th)?
So the images have spacing to 8 digits, but it is identical across all images. Does ITK have a 10^-6 limit in precision?
for file in files: if '405.nrrd' in file: readData, header = nrrd.read('/Datasets/Montage NRRDs/'+file) print(np.sum(header['space directions'], axis = 0))
[0.10048828 0.10048828 0.96774194] [0.10048828 0.10048828 0.96774194] [0.10048828 0.10048828 0.96774194] [0.10048828 0.10048828 0.96774194] [0.10048828 0.10048828 0.96774194] [0.10048828 0.10048828 0.96774194]
(for note, spacing is strictly orthogonal in my files, so the column sum is just a simplification of the following:
array([[0.10048828, 0. , 0. ], [0. , 0.10048828, 0. ], [0. , 0. , 0.96774194]])
Internally, ITK uses double
for spacing, origin and direction information. It is just that by default, libraries print out less decimal digits. double
is usually fully represented by 16-17 decimal places.
The code makes a comparison using all recorded decimals: https://github.com/InsightSoftwareConsortium/ITKMontage/blob/21f8eb99ae350f4c0d271da149fea2adeda7d6e1/include/itkPhaseCorrelationImageRegistrationMethod.hxx#L542 That might be strict, but when dealing with homogeneous tiles, any deviation in metadata usually indicates an error.
This module is currently not actively developed, so if you want a less strict comparison, please submit a PR.
FWIW I went through and rounded the spacing to 6 decimal places using pynrrd, saved the files, and the montage command seems to work, so this seems like a good workaround given that all my tiles had identical spacing, but was still throwing the identical spacing error check.
First off - thank you so much for continuing to respond to issues thus far. I'm trying to use your tool to stitch together a 3x2 microscopy image using the Nuclear stain channel, and following your "SimpleMontage.py" but I am running into a very strange error detailed below:
Error:
Code Block
I follow your SimpleMontage.py tutorial script exactly, but the exact error happens here:
Files I can make the exact files available, but they are large, so not sure if it is appropriate to send over github. These files first split by channel and converted from .ims images (a bioformats compatable format generated by Andor Dragonfly Confocal Microscopes) to .nrrd via ImageJ/Fiji to try to better match the tutorial.
Please let me know if there's any other information I can send over. And thanks in advance for your help.