-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
antsRegistration does not produce equivalent results #210
Comments
Please see this thread where these issues are discussed. |
just a comment on the scientific result - this would suggest ( already
fairly clear from the literature ) that univariate VLSM results are not
very stable. of course, one can exploit this uncertainty in order to
better understand the nature of the estimation problem.
worth adding some of this information to the `antsRegistration`
documentation in order to head off repeat discussion.
will leave this open until a contribution to the DOC is made by myself or
someone else.
brian
…On Thu, Mar 29, 2018 at 11:04 AM, Nick Tustison ***@***.***> wrote:
Please see this thread <ANTsX/ANTs#444> where
these issues are discussed.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#210 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AATyftSHh8knfPsPh2r_bEfQWQ43J8SIks5tjPffgaJpZM4TAbCv>
.
|
It seems like that thread (ANTsX/ANTs#444 (comment)) indicated changing If so, what about changing |
That was also my understanding of that thread, but it doesn't seem like antsRegistration will accept a |
Massive impact on memory use and creates more maintenance overhead Due to
need for converting between types ... furthermore, no guarantee it will fix
the issue. Running in single threaded mode without random sampling in the
metric is probably good enough. Although I have not tested that recently.
On Thu, Mar 29, 2018 at 11:43 AM John Muschelli ***@***.***> wrote:
It seems like that thread (ANTsX/ANTs#444 (comment)
<ANTsX/ANTs#444 (comment)>)
indicated changing --float to --double may help, is that correct?
If so, what about changing
https://github.com/ANTsX/ANTsRCore/blob/master/R/antsRegistration.R#L494
to --double.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#210 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AATyfn2ztlIqa_SYDjAyksVVLwzrZBH2ks5tjQEngaJpZM4TAbCv>
.
--
brian
|
I'd like to test running this in single threaded mode without random sampling, but how do I specify that within ANTsR? |
I think you would need dense sampling (strategy "NONE") to have completely reproducible results. With regular sampling, a perturbation is applied to the points to randomize their location within the voxel grid. |
Please pardon my ignorance, but I do not know enough about how ANTsR communicates with ITK (or about how ITK works) in order to implement the solutions that have been described here. As I understand it, two strategies have been proposed: Any advice about implementing either or both of these would be most appreciated. |
You could then use double by specifying "--float 0", i.e.,
See here for an example. In the same file you can see how all the different transforms are defined. |
I find this issue quite disturbing. Has anybody tried to check all three
options to see which one resolves the problem, or whether they are all
valid approaches to enhance reproducibility in an additive manner:
- double/float
- sample density (default 0.25)
- single core vs multiple core
Probably this should be part of a larger effort to enhance registration
reproducibility.
Dorian
…On Thu, Mar 29, 2018, 17:39 Nick Tustison ***@***.***> wrote:
antsRegistration, as defined in ANTsR, is used more like a script which
simplifies the underlying antsRegistration tool in ANTs. If you need to
perform your experiments within ANTsR, you might want to access the
underlying program using the antsRegistration( list_of_arguments )
format. For example, to see the short and long help menus, you can type
> antsRegistration( list( '-h', 1 ) )
> antsRegistration( list( '--help', 1 ) )
You could then use double by specifying "--float 0", i.e.,
> args <- list( "-d", ... "--float", "0", ... )
> antsRegistration( args )
See here
<https://github.com/ANTsX/ANTsRCore/blob/master/R/antsRegistration.R#L284-L294>
for an example. In the same file you can see how all the different
transforms are defined.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#210 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AIqafd5asjfB59sBWQheJqLoP-BNvKFFks5tjVR7gaJpZM4TAbCv>
.
|
the solution:
Go into Itk ; set a fixed seed; no multi threading... should be very
reproducible.
But you lose multithreading
speed-up
and hide the uncertainty intrinsic to the problem.
Choose your poison.
If the
population statistical
outputs are sensitive to tiny variations in rotation parameters, then there
are other issues one should worry about.
There were a few papers that worked on voting schemes for registration.
The point
was to acknowledge that the solutions are uncertain and then to use that to
bootstrap
the estimate ie find a median solution or something along those lines.
anyway, not much here to justify new work. if you want to open an issue at
ITK, then point
to this:
https://github.com/InsightSoftwareConsortium/ITK/blob/
8a2a15f41218c925c0a89119e09419d48f83eb22/Modules/Registration/
RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx#L940-L949
which you would want to set as a fixed seed. however, there is a cost to
that -
how do you choose the seed?
then, you might ask - why perturb the points at all? it's b/c there is
estimation bias if you
sample the grid in a perfectly regular manner.
http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf
and, again, there is the fundamental computational issue:
https://en.wikipedia.org/wiki/Kahan_summation_algorithm
frequent issue in scientific computing.
|
Thanks Brian--informative as always. I added this wiki page as an initial attempt for addressing the relevant issues. Let me know if you'd like something different. |
I can confirm that using double precision is computationally impractical: I tried it for a Rigid registration and it still hadn't finished after several hours (float version takes ~20sec). Thanks everyone for an informative discussion. |
should not lead to that much computation time difference - unless you are
running out of memory.
brian
…On Mon, Apr 2, 2018 at 10:10 AM, Dan Mirman ***@***.***> wrote:
I can confirm that using double precision is computationally impractical:
I tried it for a Rigid registration and it still hadn't finished after
several hours (float version takes ~20sec). Thanks everyone for an
informative discussion.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#210 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AATyfgZOXHsFWPU37Ks4UzuKEMwH9PBlks5tkjFngaJpZM4TAbCv>
.
|
we can close this issue due to several recent changes in ANTs and ANTsR. you will need to define (in your environment) ANTS_RANDOM_SEED=1 (or whatever your favorite number is). e.g. my .Renviron file reads:
this should give you repeatable results. ultimately, we may also allow a command line parameter to control the seed. one note: histogram matching induced an additional unexpected source of random variability. @ncullen93 may find this of interest as well. |
In testing ANTs registration, we discovered it is not reproducible: running several times on the same inputs gives different morphisms. Implementing: ANTS_RANDOM_SEED=1234 as suggested above, does not seem to completely resolve the issue. I see based on CPU usage that threads are not created. But it is impossible for me to check if fixing seed took effect. We are using version 2.3.1, should these variables have effect in this version? Are there other methods to enforce reproducibility? P.S. It is not obvious to me how randomness can help solving for brain morphism (random seed suggests it is done on purpose), but this is not the question at hand. |
@moskvich412 I see that you have read a couple of the comments in this thread, specifically the last comment from @stnava dealing with |
Yes, i did read some references, some paper on some sampling strategy, and why one by some name i can not remember which is generalization to 3D of some other name that i can not remember than uniform sampling. Other things on importance of order of summation and threads.
However, my reading does not answer the question how to make ANTs reproducible.
If humans are asked to segment same brain several times, the results will be different. Why? Because in some tough situations humans will not know how to decide, and not remember what they did last time.
If ANTs wants to mimic that aspect of human behavior, then it is likely successful. I consider this a limitation of human brain and would like ANTs to surpass humans. Why? Because when we reprocess data and get different result it is very hard to understand the cause when things are intrinsically unstable. We have to study the effect of morphism (or anything else) variability on the results, and try to understand if the observed deviation of a given reprocessing is outside of the natural variability.
Putting philosophy aside, did i do the right thing to make ANTs reproducible for the version we have? Is there else to try? Is remaining variability intrinsic and can not be turned off? Is there another version of ANTs which has the same morphism quality and reproducible?
Roman
Sent from my T-Mobile 4G LTE Device
…-------- Original message --------
From: Nick Tustison <notifications@github.com>
Date: 9/28/19 11:15 AM (GMT-05:00)
To: ANTsX/ANTsR <ANTsR@noreply.github.com>
Cc: Roman Fleysher <roman.fleysher@einstein.yu.edu>, Mention <mention@noreply.github.com>
Subject: Re: [ANTsX/ANTsR] antsRegistration does not produce equivalent results (#210)
@moskvich412<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fmoskvich412&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7C33de4fc91da64ea5411e08d74426bfbd%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052805523853370&sdata=PPIjQ64e3g2GghxMguW8aHKCy6pimGKUxVMYPo8Vvlk%3D&reserved=0> I see that you have read a couple of the comments in this thread, specifically the last comment from @stnava<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fstnava&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7C33de4fc91da64ea5411e08d74426bfbd%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052805523863368&sdata=OYxzyrErwHngYrHCXNqKpqk4SCoVYRvJ%2BEaTQSVMef4%3D&reserved=0> dealing with ANTS_RANDOM_SEED and ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS but have you read some of the other comments pointing to some of the foundational problems with this issue that goes beyond ANTs? There are even some references pointing to discussion of these algorithmic stochastic elements and why they're important, including in the study of brain morphisms.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2FANTsX%2FANTsR%2Fissues%2F210%3Femail_source%3Dnotifications%26email_token%3DANKPD2Z3HRSXZPY22UWIDIDQL5YKNA5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD723Y4Y%23issuecomment-536198259&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7C33de4fc91da64ea5411e08d74426bfbd%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052805523863368&sdata=4CTnxTRrSqwerGEcuhIDU9q5JPmPobduKBJszI9ekvA%3D&reserved=0>, or mute the thread<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FANKPD25DASAL3YHI3N2BMCDQL5YKNANCNFSM4EYBWCXQ&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7C33de4fc91da64ea5411e08d74426bfbd%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052805523863368&sdata=KMiHHbkN1CzV6CPxrtE0QSEM9h4dCnVA5NxP3a9FMBA%3D&reserved=0>.
|
You've probably done all you can to remove ANTs variability. |
I thought fixing the seed took care of this, but if you can share a code and data I may be able to say more.
…Sent from my iPhone
On Sep 28, 2019, at 11:36 AM, moskvich412 ***@***.***> wrote:
Putting philosophy aside, did i do the right thing to make ANTs reproducible for the version we have? Is there else to try? Is remaining variability intrinsic and can not be turned off? Is there another version of ANTs which has the same morphism quality and reproducible?
|
There is no code to share. I am running compiled code. I tried on mouse and human, several pairs, several runs on each pair. They look similar, but visibly different. I am not talking about 4th decimal place. Likely second decimal.
I thought fixing the seed took care of this, but if you can share a code and data I may be able to say more.
Sent from my iPhone
On Sep 28, 2019, at 11:36 AM, moskvich412 ***@***.***> wrote:
Putting philosophy aside, did i do the right thing to make ANTs reproducible for the version we have? Is there else to try? Is remaining variability intrinsic and can not be turned off? Is there another version of ANTs which has the same morphism quality and reproducible?
—
|
I mean the commands that you ran
Sent from my iPhone
On Sep 28, 2019, at 12:30 PM, moskvich412 <notifications@github.com<mailto:notifications@github.com>> wrote:
There is no code to share. I am running compiled code. I tried on mouse and human, several pairs, several runs on each pair. They look similar, but visibly different. I am not talking about 4th decimal place. Likely second decimal.
-------- Original message --------
From: Philip Cook <notifications@github.com<mailto:notifications@github.com>>
Date: 9/28/19 12:17 PM (GMT-05:00)
To: ANTsX/ANTsR <ANTsR@noreply.github.com<mailto:ANTsR@noreply.github.com>>
Cc: Roman Fleysher <roman.fleysher@einstein.yu.edu<mailto:roman.fleysher@einstein.yu.edu>>, Mention <mention@noreply.github.com<mailto:mention@noreply.github.com>>
Subject: Re: [ANTsX/ANTsR] antsRegistration does not produce equivalent results (#210)
I thought fixing the seed took care of this, but if you can share a code and data I may be able to say more.
Sent from my iPhone
On Sep 28, 2019, at 11:36 AM, moskvich412 ***@***.******@***.***>> wrote:
Putting philosophy aside, did i do the right thing to make ANTs reproducible for the version we have? Is there else to try? Is remaining variability intrinsic and can not be turned off? Is there another version of ANTs which has the same morphism quality and reproducible?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2FANTsX%2FANTsR%2Fissues%2F210%3Femail_source%3Dnotifications%26email_token%3DANKPD24CUWKORS2STSGQMHDQL57RLA5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725CCY%23issuecomment-536203531&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7Ca1a4cc38f43a4440e2a708d7442f5991%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052842480395917&sdata=xqCQliG34AIBYQ%2FYTAB7q3I5RfgsQZGKLwGMSEcwbkE%3D&reserved=0>, or mute the thread<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FANKPD25IFXJSB6USGMZFYQ3QL57RLANCNFSM4EYBWCXQ&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7Ca1a4cc38f43a4440e2a708d7442f5991%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052842480405914&sdata=Ty%2FPv1JYtg35dSlVfAaMQsCq4WMC7RpQVBSrYmKuuCg%3D&reserved=0>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#210?email_source=notifications&email_token=AAEVJM2C4QUFM7L7NVMJGK3QL6BB5A5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725KMI#issuecomment-536204593>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAEVJM6GV4534DDBLFEFMKDQL6BB5ANCNFSM4EYBWCXQ>.
|
I am also interested in having a reproducible=TRUE in antsRegistration().
Would be good to have ANTsR itself take care of the needed arguments (seed
and threads) to achieve it, and perhaps return the seed number for
future use.
…On Sat, Sep 28, 2019, 12:36 PM Philip Cook ***@***.***> wrote:
I mean the commands that you ran
Sent from my iPhone
On Sep 28, 2019, at 12:30 PM, moskvich412 ***@***.***
***@***.***>> wrote:
There is no code to share. I am running compiled code. I tried on mouse
and human, several pairs, several runs on each pair. They look similar, but
visibly different. I am not talking about 4th decimal place. Likely second
decimal.
-------- Original message --------
From: Philip Cook ***@***.***<mailto:
***@***.***>>
Date: 9/28/19 12:17 PM (GMT-05:00)
To: ANTsX/ANTsR ***@***.******@***.***>>
Cc: Roman Fleysher ***@***.***<mailto:
***@***.***>>, Mention ***@***.***
***@***.***>>
Subject: Re: [ANTsX/ANTsR] antsRegistration does not produce equivalent
results (#210)
I thought fixing the seed took care of this, but if you can share a code
and data I may be able to say more.
Sent from my iPhone
> On Sep 28, 2019, at 11:36 AM, moskvich412 ***@***.***
***@***.***>> wrote:
>
> Putting philosophy aside, did i do the right thing to make ANTs
reproducible for the version we have? Is there else to try? Is remaining
variability intrinsic and can not be turned off? Is there another version
of ANTs which has the same morphism quality and reproducible?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2FANTsX%2FANTsR%2Fissues%2F210%3Femail_source%3Dnotifications%26email_token%3DANKPD24CUWKORS2STSGQMHDQL57RLA5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725CCY%23issuecomment-536203531&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7Ca1a4cc38f43a4440e2a708d7442f5991%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052842480395917&sdata=xqCQliG34AIBYQ%2FYTAB7q3I5RfgsQZGKLwGMSEcwbkE%3D&reserved=0>,
or mute the thread<
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FANKPD25IFXJSB6USGMZFYQ3QL57RLANCNFSM4EYBWCXQ&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7Ca1a4cc38f43a4440e2a708d7442f5991%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052842480405914&sdata=Ty%2FPv1JYtg35dSlVfAaMQsCq4WMC7RpQVBSrYmKuuCg%3D&reserved=0>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<
#210?email_source=notifications&email_token=AAEVJM2C4QUFM7L7NVMJGK3QL6BB5A5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725KMI#issuecomment-536204593>,
or mute the thread<
https://github.com/notifications/unsubscribe-auth/AAEVJM6GV4534DDBLFEFMKDQL6BB5ANCNFSM4EYBWCXQ>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#210?email_source=notifications&email_token=ACFJU7OLCTA7DZHZVPUJOVDQL6BX7A5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725OVA#issuecomment-536205140>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACFJU7JKPPFB2L3VLDK3FT3QL6BX7ANCNFSM4EYBWCXQ>
.
|
Is the code being run in ants or ANTsR? It wasn’t entirely clear from the
message. I understand it’s an issue on this repo but just wanted to make
sure
On Sat, Sep 28, 2019 at 1:16 PM dorianps ***@***.***> wrote:
I am also interested in having a reproducible=TRUE in antsRegistration().
Would be good to have ANTsR itself take care of the needed arguments (seed
and threads) to achieve it, and perhaps return the seed number for
future use.
On Sat, Sep 28, 2019, 12:36 PM Philip Cook ***@***.***>
wrote:
> I mean the commands that you ran
>
> Sent from my iPhone
>
> On Sep 28, 2019, at 12:30 PM, moskvich412 ***@***.***
> ***@***.***>> wrote:
>
> There is no code to share. I am running compiled code. I tried on mouse
> and human, several pairs, several runs on each pair. They look similar,
but
> visibly different. I am not talking about 4th decimal place. Likely
second
> decimal.
>
>
>
>
> -------- Original message --------
> From: Philip Cook ***@***.***<mailto:
> ***@***.***>>
> Date: 9/28/19 12:17 PM (GMT-05:00)
> To: ANTsX/ANTsR ***@***.***<mailto:
***@***.***>>
>
> Cc: Roman Fleysher ***@***.***<mailto:
> ***@***.***>>, Mention ***@***.***
> ***@***.***>>
> Subject: Re: [ANTsX/ANTsR] antsRegistration does not produce equivalent
> results (#210)
>
> I thought fixing the seed took care of this, but if you can share a code
> and data I may be able to say more.
>
>
> Sent from my iPhone
>
> > On Sep 28, 2019, at 11:36 AM, moskvich412 ***@***.***
> ***@***.***>> wrote:
> >
> > Putting philosophy aside, did i do the right thing to make ANTs
> reproducible for the version we have? Is there else to try? Is remaining
> variability intrinsic and can not be turned off? Is there another version
> of ANTs which has the same morphism quality and reproducible?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub<
>
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2FANTsX%2FANTsR%2Fissues%2F210%3Femail_source%3Dnotifications%26email_token%3DANKPD24CUWKORS2STSGQMHDQL57RLA5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725CCY%23issuecomment-536203531&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7Ca1a4cc38f43a4440e2a708d7442f5991%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052842480395917&sdata=xqCQliG34AIBYQ%2FYTAB7q3I5RfgsQZGKLwGMSEcwbkE%3D&reserved=0
>,
> or mute the thread<
>
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FANKPD25IFXJSB6USGMZFYQ3QL57RLANCNFSM4EYBWCXQ&data=02%7C01%7Croman.fleysher%40einstein.yu.edu%7Ca1a4cc38f43a4440e2a708d7442f5991%7C04c70eb48f2648079934e02e89266ad0%7C1%7C0%7C637052842480405914&sdata=Ty%2FPv1JYtg35dSlVfAaMQsCq4WMC7RpQVBSrYmKuuCg%3D&reserved=0
>.
>
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub<
>
#210?email_source=notifications&email_token=AAEVJM2C4QUFM7L7NVMJGK3QL6BB5A5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725KMI#issuecomment-536204593
>,
> or mute the thread<
>
https://github.com/notifications/unsubscribe-auth/AAEVJM6GV4534DDBLFEFMKDQL6BB5ANCNFSM4EYBWCXQ
>.
>
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#210?email_source=notifications&email_token=ACFJU7OLCTA7DZHZVPUJOVDQL6BX7A5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD725OVA#issuecomment-536205140
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/ACFJU7JKPPFB2L3VLDK3FT3QL6BX7ANCNFSM4EYBWCXQ
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#210?email_source=notifications&email_token=AAIGPLUDN4FMEEPF3CBRVM3QL6GQBA5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD726IFA#issuecomment-536208404>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIGPLXOSGDESBT4GAHA4JLQL6GQBANCNFSM4EYBWCXQ>
.
--
Best,
John
|
I use this bash script to compute totalTransform.nii.gz: export ANTS_RANDOM_SEED=10 N3BiasFieldCorrection 3 input.nii.gz input.nii.gz 4 ANTS 3 -m CC[template.nii.gz,input.nii.gz,1,4] -t SyN[0.25] ComposeMultiTransform 3 totalTransform.nii.gz -R template.nii.gz prefixWarp.nii.gz prefixAffine.txt The output morphism, totalTransform.nii.gz, is then applied using: WarpImageMultiTransform 3 input.nii.gz morphedInput.nii.gz totalTransform.nii.gz -R totalTransform.nii.gz I see that both N3BiasFieldCorrection and ANTS are running in a single thread. We are using version 2.3.1. Comments on the choice of metrics, iterations, etc are also welcome. Maybe there is a better set. |
See an example here ... looks like Mattes is not reproducible. Comments welcome. It would be good to add Python and bash examples to above. Please contribute via pull request. We don't recommend using the program called |
@muschellij2 Can you post an input image where this occurs? There's no explicitly random element in |
What I mean is:
original image: input.nii.gz:
iteration 1:
N3BiasFieldCorrection 3 input.nii.gz input.nii.gz 4 (call this
input_1.nii.gz)
run warping and such
N3BiasFieldCorrection 3 input.nii.gz input.nii.gz 4
Now this command is really:
N3BiasFieldCorrection 3 input_1.nii.gz input_2.nii.gz 4
Note that the original input to N3 in iter 2 is not the same as iter 1.
Best,
John
…On Mon, Oct 7, 2019 at 10:13 AM Nick Tustison ***@***.***> wrote:
@muschellij2 <https://github.com/muschellij2> Can you post an input image
where this occurs? There's no explicitly random element in
N3BiasFieldCorrection so I'm curious as to where this is happening.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#210?email_source=notifications&email_token=AAIGPLRFM2SU5NYUMQ6YQITQNM7YXA5CNFSM4EYBWCX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAQPS7I#issuecomment-539031933>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIGPLVWMCUOGHEQL4K6TG3QNM7YXANCNFSM4EYBWCXQ>
.
|
Okay, thanks for the clarification. I was worried since N4 has gone through changes over in the ITK GitHub repo, some of which concern overlapping elements with N3 and I wanted to make sure that I wasn't behind in my upkeep. |
I am sorry for not being clear. The set of commands I wrote were internal parts of my script, which first makes local copies of the input and template. Bias correction is not iteratively applied. I played with it separately and each iteration does change the image. There is no way to terminate this process because there is no good way to distinguish receive and transmit coils and T1 weighting in the context of MRI from the actual spatial variation in the image. I also realized I was under influence of the older, version 1.9, manual which talked about the routines affected by randomness. I am glad the cause was my use of the deprecated commands which I will now fix and get reproducible results. |
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
This makes the output deterministic, at the cost of running unnecessarily slowly. The order of the floating point sums used internally is numerically unstable. See https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues ANTsX/ANTs#444 (comment) ANTsX/ANTsR#210 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
This is also to make the output deterministic, at the cost of running slow. It turned out that using dense sampling wasn't enough; there was still some numerical instability that came from the order of addition: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux. I [showed](#2642 (comment)) that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something still unknown about how we call it was hiding it there. See: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTs#444 (comment) * ANTsX/ANTsR#210 (comment)
This is also to make the output deterministic, at the cost of running slow. It turned out that using dense sampling wasn't enough; there was still some numerical instability that came from the order of addition: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux. I [showed](#2642 (comment)) that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something still unknown about how we call it was hiding it there. This was actually supposed to be in place already but the code had atrophied, so all this does is fix it up. See: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTs#444 (comment) * ANTsX/ANTsR#210 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
This is also to make the output deterministic, at the cost of running slow. It turned out that using dense sampling wasn't enough; there was still some numerical instability that came from the order of addition: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux. I [showed](#2642 (comment)) that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something still unknown about how we call it was hiding it there. This was actually supposed to be in place already but the code had atrophied, so all this does is fix it up. See: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTs#444 (comment) * ANTsX/ANTsR#210 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
This is also to make the output deterministic, at the cost of running slow. It turned out that using dense sampling wasn't enough; there was still some numerical instability that came from the order of addition: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux. I [showed](#2642 (comment)) that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something still unknown about how we call it was hiding it there. This was actually supposed to be in place already but the code had atrophied, so all this does is fix it up. See: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTs#444 (comment) * ANTsX/ANTsR#210 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
This is also to make the output deterministic, at the cost of running slow. It turned out that using dense sampling wasn't enough; there was still some numerical instability that came from the order of addition: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux. I [showed](#2642 (comment)) that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something still unknown about how we call it was hiding it there. This was actually supposed to be in place already but the code had atrophied, so all this does is fix it up. See: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTs#444 (comment) * ANTsX/ANTsR#210 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> I think ideally moco.py would thinly wrap antsRegistration, and expose both .sampling_strategy and .sampling_percentage directly, but until now we've always hardcoded 'samplingStrategy=Regular' so in the interest of not rocking the boat too much all I did was add a 'sampling=None' case, *and set it as the default* Updated version re feedback: #2642 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> Because we are hard-coding the sampling rate I removed it from ParamMoco entirely. If we want to support it properly we would have to pass .sampling_strategy and .sampling_percentage separately.
This is also to make the output deterministic, at the cost of running slow. It turned out that using dense sampling wasn't enough; there was still some numerical instability that came from the order of addition: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux. I [showed](#2642 (comment)) that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something still unknown about how we call it was hiding it there. This was actually supposed to be in place already but the code had atrophied, so all this does is fix it up. See: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTs#444 (comment) * ANTsX/ANTsR#210 (comment)
Upon upgrading our ANTS build we found that motion correction was no longer deterministic (#2642 (comment)). The ANTS maintainers suggested setting samplingStrategy=None (ANTsX/ANTs#976 (comment)) to get deterministic output, but they also warned that this will induce a variance-for-bias tradeoff: * https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues * ANTsX/ANTsR#210 (comment) * Thévenaz, P., Bierlaire, M., & Unser, M. (2008). Halt on sampling for image registration based on mutual information. Sampling Theory in Signal and Image Processing, 7(2). <http://bigwww.epfl.ch/preprints/thevenaz0602p.pdf> I think ideally moco.py would thinly wrap antsRegistration, and expose both .sampling_strategy and .sampling_percentage directly, but until now we've always hardcoded 'samplingStrategy=Regular' so in the interest of not rocking the boat too much all I did was add a 'sampling=None' case, *and set it as the default* Updated version re feedback: #2642 (comment)
So revisiting this a bit again, I think there is a sneaky bug somewhere for this. I don't believe this is fixed. Here are 3 different scenarios, setting environment variables before loading (like Setting the Seed before
|
Can anyone confirm this on their machine? @adigherman ? @cookpa @stnava |
Will try but may take some days |
Hello! I would like to store the seed that was used in a specific run, so that we are able to reproduce that data in the future. How can this be done? Thanks in advance! |
Multiple runs of antsRegistration() on the same images produces different results. Here is a simple example:
Similarly non-identical results show up for other transforms ("Affine", "SyNCC"). Although the differences seem somewhat small, it is not clear why they are different at all. More importantly, these small differences have substantive consequences down-stream: we ran a lesion-symptom mapping analysis and wanted to describe the results in terms of the AAL atlas, but the 10 somewhat different transformations produce somewhat different descriptions:
In my test, I get anywhere from 7 to 11 clusters, with slightly different masses and (x,y,z) coordinates.
This was run most recently using R version 3.3.1, ANTsR version: 0.5.6, ANTsRCore version 0.3.4, but we've replicated this problem on two different Linux machines.
The text was updated successfully, but these errors were encountered: