Open poldrack opened 2 years ago
@poldrack --- I'll put this on my to-do list as well as the other issue. Currently trying to get an initial manuscript draft together and @stnava is also pretty busy at the moment. I'll first look to see if I can duplicate the behaviors in the core ANTs repository, since these issues should be addressed there as well, if necessary. However, if you've already done that, please let us know what you found.
I'll try running the same analyses using ANTs binaries and see if the same problems occur - lmk if you'd like me to post those results to the core ANTs repo or just continue the discussion here...
We can just continue the conversation here.
I had a quick pass at it and TBH the command line version is just not something I have time to make work right now - just way too complex without sufficiently clear documentation. happy to share the data if y'all want to try it out.
Sure, I'll take a look at a sample data set
great, email me at poldrack@gmail.com and I'll send a link
No worries, @poldrack and thanks, @cookpa . If you don't get to it by this weekend (as well as the registration dimensionality issue), I'll be sure to take a look.
antsMotionCorr
does not run at all with the "size-mm_units-mm" files:
$ antsMotionCorr -d 3 -u 1 --use-histogram-matching 0 -m MI[ ants_example_data/series-tdtomato_size-mm_units-mm_mean.nii , ants_example_data/series-tdtomato_size-mm_units-mm.nii , 1, 32, Regular, 1 ] -t Rigid[ 0.1 ] -f 1x1 -s 1x0 -i 50x50 -o [ series-tdtomato_size-mm_units-mm_moco, series-tdtomato_size-mm_units-mm_mocoWarped.nii.gz ] --verbose
verbose
Registration using 1 total stages.
Stage 1
fixed image: ants_example_data/series-tdtomato_size-mm_units-mm_mean.nii
moving image: ants_example_data/series-tdtomato_size-mm_units-mm.nii
number of levels = 2
shrink factors per level: [1, 1]
smoothing sigmas per level: [1, 0]
using fixed reference image for all frames
use histogram matching 0
regular sampling (percentage = 1)
using the Mattes MI metric.
*** Running rigid registration ***0
Exception caught:
itk::ExceptionObject (0x7fa779d11ad0)
Location: "unknown"
File: /Users/pcook/tmp/NOT_BACKED_UP/antsMaster/build/staging/include/ITK-5.3/itkMattesMutualInformationImageToImageMetricv4.hxx
Line: 311
Description: ITK ERROR: MattesMutualInformationImageToImageMetricv4(0x7fa77b9ce650): All samples map outside moving image buffer. The images do not sufficiently overlap. They need to be initialized to have more overlap before this metric will work. For instance, you can align the image centers by translation.
I reproduced the error after converting the nii files to mha with c3d / c4d. So I think it's not related to the ITK NIFTI I/O issues for small voxels that we've discussed on the ANTs page.
But after replacing mm units with um in the MHA header, it runs. Likewise, using the "ants_example_data/series-tdtomato_size-um_units-mm" images in the above command runs as well.
My guess is that it's the gradient scale estimator. @poldrack , is it okay if @cookpa cc's me on the link to the data?
@ntustison Russ said I could share it, will forward you the link.
Yep, no problem!
On Fri, Apr 29, 2022 at 4:40 PM Nick Tustison @.***> wrote:
My guess is that it's the gradient scale estimator. @poldrack https://github.com/poldrack , is it okay if @cookpa https://github.com/cookpa cc's me on the link to the data?
— Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsPy/issues/362#issuecomment-1113862981, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGUVECGKMXZC3METLIKLLTVHRXP5ANCNFSM5UWW47HA . You are receiving this because you were mentioned.Message ID: @.***>
-- Russell A. Poldrack Albert Ray Lang Professor of Psychology Associate Director, Stanford Data Science Director, SDS Center for Open and Reproducible Science Building 420 Stanford University Stanford, CA 94305
@. @.> http://www.poldracklab.org/
Describe the bug
ants.motion_correction()
fails intermittently (over timepoints) on 2-photon imaging data with micron resolution when the resolution is correctly specified (either in microns or in millimeters). It works properly with the same data if the resolution is incorrectly specified as microns * 1000 (ie pretending that microns are actually millimeters). The failure varies from run to run with identical data, suggesting that it might be related to random initialization.The problem is demonstrated here:
https://github.com/poldrack/brainsss/blob/main/ants_testing/MotionCorrectionIssue.ipynb
I'm happy to share the data if you'd like to use it for testing.
Expected behavior I would expect the function to either automatically adapt to voxel size, or to raise an exception that the voxel size is out of bounds, with a suggestion for what command line parameters might be modified to fix the problem.