Discussion:
[ITK-users] [ITK] Normalized Cross Correlation returns perfect alignment with images not even overlapping
Andrew Harris
2017-03-30 18:13:05 UTC
Permalink
Hi, I'm hoping someone can guide me toward an explanation of this. I run
my pipeline on various ultrasound image sets and get an NCC between 0.65
and 0.8 for good alignments, but on some sets the NCC returns 1.0 when the
images aren't even overlapping. I have the black areas of the image masked
out, and have even tried cranking up the threshold to be sure the darker
areas aren't being included to no avail. Any thoughts?

--

AH


-----------------------------------------------------------------------------------------------

*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Dženan Zukić
2017-03-30 23:25:42 UTC
Permalink
Hi Andrew,

your masks might be inverted. If NCC gets all black pixels in both images,
the correlation will be perfect.

Regards,
DÅŸenan
Post by Andrew Harris
Hi, I'm hoping someone can guide me toward an explanation of this. I run
my pipeline on various ultrasound image sets and get an NCC between 0.65
and 0.8 for good alignments, but on some sets the NCC returns 1.0 when the
images aren't even overlapping. I have the black areas of the image masked
out, and have even tried cranking up the threshold to be sure the darker
areas aren't being included to no avail. Any thoughts?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Andrew Harris
2017-04-11 12:36:13 UTC
Permalink
In the image mask, the parts we want to include in the calculation are
bright and the parts that we want to exclude are dark, is that the opposite
of what it should be?

--

AH


-----------------------------------------------------------------------------------------------

*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Post by Dženan Zukić
Hi Andrew,
your masks might be inverted. If NCC gets all black pixels in both images,
the correlation will be perfect.
Regards,
DÅŸenan
Post by Andrew Harris
Hi, I'm hoping someone can guide me toward an explanation of this. I run
my pipeline on various ultrasound image sets and get an NCC between 0.65
and 0.8 for good alignments, but on some sets the NCC returns 1.0 when the
images aren't even overlapping. I have the black areas of the image masked
out, and have even tried cranking up the threshold to be sure the darker
areas aren't being included to no avail. Any thoughts?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Francois Budin
2017-04-11 13:00:16 UTC
Permalink
Hello Andrew,

Did you try to initialize the registration with [1] for example?
If the images do not overlap at all at the beginning of the registration,
the algorithm might only do what DÅŒenan said, match black pixels.
Initializing the transform should help.

Hope this helps,
Francois

[1]
https://itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer.html
Post by Andrew Harris
In the image mask, the parts we want to include in the calculation are
bright and the parts that we want to exclude are dark, is that the opposite
of what it should be?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Post by Dženan Zukić
Hi Andrew,
your masks might be inverted. If NCC gets all black pixels in both
images, the correlation will be perfect.
Regards,
DÅŸenan
Post by Andrew Harris
Hi, I'm hoping someone can guide me toward an explanation of this. I
run my pipeline on various ultrasound image sets and get an NCC between
0.65 and 0.8 for good alignments, but on some sets the NCC returns 1.0 when
the images aren't even overlapping. I have the black areas of the image
masked out, and have even tried cranking up the threshold to be sure the
darker areas aren't being included to no avail. Any thoughts?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Andrew Harris
2017-04-11 18:02:49 UTC
Permalink
Hello Francois and DÅŸenan,

Because of the way the images were captured, there is a known common point
of overlap, so we set the centre to that point in the expectation that the
transform would rotate and translate about that point when the registration
is run. Have I misunderstood the design or is that what should be
happening?

--

AH


-----------------------------------------------------------------------------------------------

*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Post by Francois Budin
Hello Andrew,
Did you try to initialize the registration with [1] for example?
If the images do not overlap at all at the beginning of the registration,
the algorithm might only do what DÅŒenan said, match black pixels.
Initializing the transform should help.
Hope this helps,
Francois
[1] https://itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer.
html
Post by Andrew Harris
In the image mask, the parts we want to include in the calculation are
bright and the parts that we want to exclude are dark, is that the opposite
of what it should be?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Post by Dženan Zukić
Hi Andrew,
your masks might be inverted. If NCC gets all black pixels in both
images, the correlation will be perfect.
Regards,
DÅŸenan
Post by Andrew Harris
Hi, I'm hoping someone can guide me toward an explanation of this. I
run my pipeline on various ultrasound image sets and get an NCC between
0.65 and 0.8 for good alignments, but on some sets the NCC returns 1.0 when
the images aren't even overlapping. I have the black areas of the image
masked out, and have even tried cranking up the threshold to be sure the
darker areas aren't being included to no avail. Any thoughts?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Dženan Zukić
2017-04-11 18:07:26 UTC
Permalink
Hi Andrew,

it is good to use such additional constraints when possible. But you also
have to initialize the transform somehow, otherwise it might get
auto-initialized to all modifiable parameters being equal to zero. That is
usually a bad initial transform - hence Francois' suggestion.

Regards,
DÅŸenan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)
Post by Andrew Harris
Hello Francois and DÅŸenan,
Because of the way the images were captured, there is a known common point
of overlap, so we set the centre to that point in the expectation that the
transform would rotate and translate about that point when the registration
is run. Have I misunderstood the design or is that what should be
happening?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
On Tue, Apr 11, 2017 at 9:00 AM, Francois Budin <
Post by Francois Budin
Hello Andrew,
Did you try to initialize the registration with [1] for example?
If the images do not overlap at all at the beginning of the registration,
the algorithm might only do what DÅŒenan said, match black pixels.
Initializing the transform should help.
Hope this helps,
Francois
[1] https://itk.org/Doxygen/html/classitk_1_1CenteredTransformIn
itializer.html
Post by Andrew Harris
In the image mask, the parts we want to include in the calculation are
bright and the parts that we want to exclude are dark, is that the opposite
of what it should be?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Post by Dženan Zukić
Hi Andrew,
your masks might be inverted. If NCC gets all black pixels in both
images, the correlation will be perfect.
Regards,
DÅŸenan
Post by Andrew Harris
Hi, I'm hoping someone can guide me toward an explanation of this. I
run my pipeline on various ultrasound image sets and get an NCC between
0.65 and 0.8 for good alignments, but on some sets the NCC returns 1.0 when
the images aren't even overlapping. I have the black areas of the image
masked out, and have even tried cranking up the threshold to be sure the
darker areas aren't being included to no avail. Any thoughts?
--
AH
------------------------------------------------------------
-----------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Francois Budin
2017-04-11 18:14:01 UTC
Permalink
Hello Andrew,

Another thing you can look at is if your transform parameters ratios are
set to reasonable values. You typically have a ratio you can set between
rotation, translation, scaling. If these are not set to appropriate values,
the final transform could be wrong.
In your case, it sounds like you are already performing the translation as
an initialization. Maybe you can modify your parameters so that it performs
mostly a rotation.

Hope this helps,
François
Post by Dženan Zukić
Hi Andrew,
it is good to use such additional constraints when possible. But you also
have to initialize the transform somehow, otherwise it might get
auto-initialized to all modifiable parameters being equal to zero. That is
usually a bad initial transform - hence Francois' suggestion.
Regards,
DÅŸenan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)
Hello Francois and DÅŸenan,
Because of the way the images were captured, there is a known common point
of overlap, so we set the centre to that point in the expectation that the
transform would rotate and translate about that point when the registration
is run. Have I misunderstood the design or is that what should be
happening?
--
AH
-----------------------------------------------------------------------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
On Tue, Apr 11, 2017 at 9:00 AM, Francois Budin <
Hello Andrew,
Did you try to initialize the registration with [1] for example?
If the images do not overlap at all at the beginning of the registration,
the algorithm might only do what DÅŒenan said, match black pixels.
Initializing the transform should help.
Hope this helps,
Francois
[1]
https://itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer.html
In the image mask, the parts we want to include in the calculation are
bright and the parts that we want to exclude are dark, is that the opposite
of what it should be?
--
AH
-----------------------------------------------------------------------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Hi Andrew,
your masks might be inverted. If NCC gets all black pixels in both images,
the correlation will be perfect.
Regards,
DÅŸenan
Hi, I'm hoping someone can guide me toward an explanation of this. I run
my pipeline on various ultrasound image sets and get an NCC between 0.65
and 0.8 for good alignments, but on some sets the NCC returns 1.0 when the
images aren't even overlapping. I have the black areas of the image masked
out, and have even tried cranking up the threshold to be sure the darker
areas aren't being included to no avail. Any thoughts?
--
AH
-----------------------------------------------------------------------------------------------
*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Loading...