Open gdevenyi opened 7 years ago
Following up, I have some new data that also throws the same errors in minctracc:
minctracc -clobber -debug -xcorr -est_center -est_translations -lsq6 -step 3.571425 3.571425 3.571425 -simplex 5.07936 -tol 0.0001 -w_shear 0.02 0.02 0.02 -w_scales 0.02 0.02 0.02 -w_rotations 0.0174533 0.0174533 0.0174533 -w_translations 0.4 0.4 0.4 -model_mask cropped_embryo_mia_30012019_reg_target_resampled/E18_mask_39micron_resampled.mnc cropped_embryo_mia_30012019_processed/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre/tmp/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre_fwhm3.571425_blur.mnc cropped_embryo_mia_30012019_reg_target_resampled/tmp/E18_39micron_resampled_fwhm3.571425_blur.mnc cropped_embryo_mia_30012019_processed/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre/tmp/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre_mt_to_E18_39micron_resampled_lsq6_0.xfm
Before parsing
===== Debugging information from minctracc =====
Data filename = cropped_embryo_mia_30012019_processed/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre/tmp/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre_fwhm3.571425_blur.mnc
Model filename = cropped_embryo_mia_30012019_reg_target_resampled/tmp/E18_39micron_resampled_fwhm3.571425_blur.mnc
Data mask filename =
Model mask filename = cropped_embryo_mia_30012019_reg_target_resampled/E18_mask_39micron_resampled.mnc
Input xform name =
Output filename = cropped_embryo_mia_30012019_processed/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre/tmp/img_21nov18.14.sept2014_dist_corr_preproc_I_lsq6_recrop_centre_mt_to_E18_39micron_resampled_lsq6_0.xfm
Step size = 3.571425 3.571425 3.571425
Sub-lattice dia = 24.000000 24.000000 24.000000
Objective function = cross correlation (threshold = 0.000000 0.000000)
Transform linear = TRUE
Transform inverted? = FALSE
Transform type = 3
Transform matrix = 1.0000 0.0000 0.0000 0.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 0.0000
Transform center = 0.000 0.000 0.000
Transform rotation = 0.000 0.000 0.000
Transform trans = 0.000 0.000 0.000
Transform scale = 1.000 1.000 1.000
Reading Volume: ...............................................................Source volume size: 179 by 305 by 219
Source voxel size = 0.040 0.040 0.040
Source min/max real range = 69.217 15639.158
Source min/max voxel= 69.217 15639.158
Target volume size: 193 by 317 by 221
Target voxel = 0.040 0.040 0.040
Target min/max real range= 24.660 1877.354
Target min/max voxel = 24.660 1877.354
Error in minctracc in file /opt/quarantine/minc-toolkit/1.9.16/src/minc-toolkit-v2/mni_autoreg/minctracc/Numerical/init_params.c, line 602
Cannot calculate the COG or COV of volume 2.
using PAT to get initial parameters:
will try to get: [center] [trans]
In set_up_lattice, xyzv[axes] = 2, 1, 0, -1
COG of v1: 0.022438 -0.347027 -0.581902
In set_up_lattice, xyzv[axes] = 2, 1, 0, -1
In set_up_lattice, xyzv[axes] = 2, 1, 0, -1
in vol to cov
start = 15.97 2.50 2.09
count = 2 4 2
step = 3.57 3.57 3.57
direct= 1.00 0.00 0.00
direct= 0.00 1.00 0.00
direct= 0.00 0.00 1.00
In set_up_lattice, xyzv[axes] = 2, 1, 0, -1
did you check if there are any NaN voxels?
I have not, will do so thanks!
Non NAN voxels.
The issue appears to be the COG/COM estimate is failing due to masking, if I remove the model_mask from the call, the command succeeds:
A visualization of why there might be a corner case:
does mask have voxels that are only 0 and 1 ?
Currently the mask has other values (see https://github.com/Mouse-Imaging-Centre/pydpiper/issues/405) in the pipeline, manually fixing the mask to only 0/1 doesn't change the result, same crash.
so, you have a minc file sampled at 0.040 mm and your lattice size is 24mm . Maybe that's the problem?
Maybe, it does seem to work without the mask. This call is automatically generated from pydpiper and I'm not quite clear on the semantics.
Paging @bcdarwin, pydpiper is driving this bug, can you comment?
also this shows something:
in vol to cov
start = 15.97 2.50 2.09
count = 2 4 2
step = 3.57 3.57 3.57
direct= 1.00 0.00 0.00
direct= 0.00 1.00 0.00
direct= 0.00 0.00 1.00
The whole volume will be sampled 2 times in x direction ( count
variable ) - if it happen to miss the mask , the result will be undefined.
When you say Pydpiper is driving this, do you mean that it's the mask issue? In your first example, there doesn't seem to be a mask.
I'm working on something that needs a principal axis transformation with pre-existing masks at the moment so perhaps I'll encounter the same issue ...
@bcdarwin I think it may be the way that the resolution spacing is chosen for the initialization, the mask in this case exposed the problem, though in the other case it was probably the resolution on its own.
I have some volumes I'm trying to register in pydpiper, minctracc can't seem to find their COG/COV, despite everything looking fine with register...