ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.2k stars 381 forks source link

About running non-rigid deformation experiment #460

Closed sucv closed 7 years ago

sucv commented 7 years ago

Hello ! I am a postgraduate whose major is non-rigid point set registration. I submitted a manuscript about my algorithm to a journal named Pattern Recognition. The reviewer asked me to provide an empirical comparison against your algorithm presented in the literature:

Nicholas J. Tustison, Suyash P. Awate, Gang Song, Tessa Sundaram Cook, James C. Gee: Point Set Registration Using Havrda-Charvat-Tsallis Entropy Measures. IEEE Trans. Med. Imaging 30(2): 451-460 (2011)

I am new to ANTs. I downloaded the PDF document of ANTs (from http://stnava.github.io/ANTsDoc/, since I concern only the image registration on 2D images, I have read section 1 and 2). I also downloaded the pre-built ANTs (from https://github.com/stnava/ANTs/releases/download/v2.1.0/ANTs_2.1.0_Windows.zip since my system is WIN10. I know that ANTs mainly focus on Linus/Unix, and can not be implemented directly on RPG images).

What I intend to do is registering arbitrary gray-scale jpg pairs using ANTs. To be more specifically, given a moving image A.jpg, a fixed image B.jpg, the transformed image C.jpg can be generate using ANTs, where the transformation model should be non-rigid (the diffeomorphic model as mentioned in the document)

I have tried the following script provided in the ZIP folder (or git from your repositories) : (i) antsRegistrationCommand.sh, where a pair of binary chicken nifti images can be registered rigidly. I tried to input a jpg pair but failed, seems that the supported format of this script is nifti.

(ii) featureMatch.sh, and the bash said that zneg1.nii.gz and zneg2.nii.gz does not exist. So I replaced the missed nii.gz with two existing files, named slide1 and slide 2.nii.gz, and managed to obtain the output nifti image.

(iii) cars.sh, and the bash said that ./cars.sh: line 31: 13308 Segmentation fault MeasureImageSimilarity 2 2 $f b2f_diff.nii.gz log.txt , where I can only generate b2f_aff.jpg, namely the affine car, but failed to generate b2f_diff.jpg, namely the elastic car.

For problem (i), according to the README.md (from https://github.com/stnava/chicken), an affine transformation model can be obtained by antsAffineInitializer 2 chicken-4.jpg chicken-3.jpg chicken3to4.mat 10 0.3 0 10, where chicken3to4.mat is the affine parameters. How can I determine the parameters for a diffeomorphic model since I cannot find a executable like antsDiffeoInitializer in the folder?

For problem (ii) and (iii), I cannot find zneg1.nii.gz and zneg2.nii.gz, nor can I figure out the reason for the segmentation fault. Did I misunderstand anything ? is it applicable to input arbitrary jpg pairs for this script?

of all scripts or executables provided in ANTs toolkit, Is there an applicable way to accomplish my desired experiment?

Thank you very much for providing any useful guidance ! Sincerely Pigs

stnava commented 7 years ago

re: (i) yes, try nifti ... read the cars.sh example to see one way to convert between image types

re: (iii) i updated the cars example on github. you might clone it and try again. it would work if you had a recent version of ants.

re: (ii) i ran

./featureMatch.sh 2 data/r16slice.nii.gz data/r16rotpart.nii.gz 400 20 1

and it seemed to work fine .... can you be more specific with your question? do you want to share some data so we can help address your question?

you might also want a more recent version of ants.

brian

On Mon, Jun 19, 2017 at 9:00 AM, PigMightFly notifications@github.com wrote:

Hello ! I am a postgraduate whose major is non-rigid point set registration. I submitted a manuscript about my algorithm to a journal named Pattern Recognition. The reviewer asked me to provide an empirical comparison against your algorithm presented in the literature:

Nicholas J. Tustison, Suyash P. Awate, Gang Song, Tessa Sundaram Cook, James C. Gee: Point Set Registration Using Havrda-Charvat-Tsallis Entropy Measures. IEEE Trans. Med. Imaging 30(2): 451-460 (2011)

I am new to ANTs. I downloaded the PDF document of ANTs (from http://stnava.github.io/ANTsDoc/, since I concern only the image registration on 2D images, I have read section 1 and 2). I also downloaded the pre-built ANTs (from https://github.com/stnava/ ANTs/releases/download/v2.1.0/ANTs_2.1.0_Windows.zip since my system is WIN10. I know that ANTs mainly focus on Linus/Unix, and can not be implemented directly on RPG images).

What I intend to do is registering arbitrary gray-scale jpg pairs using ANTs. To be more specifically, given a moving image A.jpg, a fixed image B.jpg, the transformed image C.jpg can be generate using ANTs, where the transformation model should be non-rigid (the diffeomorphic model as mentioned in the document)

I have tried the following script provided in the ZIP folder (or git from your repositories) : (i) antsRegistrationCommand.sh, where a pair of binary chicken nifti images can be registered rigidly. I tried to input a jpg pair but failed, seems that the supported format of this script is nifti.

(ii) featureMatch.sh, and the bash said that zneg1.nii.gz and zneg2.nii.gz does not exist. So I replaced the missed nii.gz with two existing files, named slide1 and slide 2.nii.gz, and managed to obtain the output nifti image.

(iii) cars.sh, and the bash said that ./cars.sh: line 31: 13308 Segmentation fault MeasureImageSimilarity 2 2 $f b2f_diff.nii.gz log.txt , where I can only generate b2f_aff.jpg, namely the affine car, but failed to generate b2f_diff.jpg, namely the elastic car.

For problem (i), according to the README.md (from https://github.com/stnava/chicken), an affine transformation model can be obtained by antsAffineInitializer 2 chicken-4.jpg chicken-3.jpg chicken3to4.mat 10 0.3 0 10, where chicken3to4.mat is the affine parameters. How can I determine the parameters for a diffeomorphic model since I cannot find a executable like antsDiffeoInitializer in the folder?

For problem (ii) and (iii), I cannot find zneg1.nii.gz and zneg2.nii.gz, nor can I figure out the reason for the segmentation fault. Did I misunderstand anything ? is it applicable to input arbitrary jpg pairs for this script?

of all scripts or executables provided in ANTs toolkit, Is there an applicable way to accomplish my desired experiment?

Thank you very much for providing any useful guidance ! Sincerely Pigs

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stnava/ANTs/issues/460, or mute the thread https://github.com/notifications/unsubscribe-auth/AATyfht-uiVZGxlAD5EnMH4Dohacqptrks5sFnD7gaJpZM4N-Mef .

sucv commented 7 years ago

The log for running featureMatch.sh is as follows:

$ ./featureMatch.sh 2 data/r16slice.nii.gz data/r16rotpart.nii.gz 400 20 1
./featureMatch.sh: line 13: 13436 Segmentation fault      N3BiasFieldCorrection                   $dim $a zneg1.nii.gz 8
./featureMatch.sh: line 14:  5948 Segmentation fault      N3BiasFieldCorrection                   $dim $b zneg2.nii.gz 8
 file zneg1.nii.gz does not exist .
 file zneg2.nii.gz does not exist .
 file zneg1.nii.gz does not exist .
./featureMatch.sh: line 21:  5720 Segmentation fault      ImageMath $dim zneg1.n                  ii.gz TruncateImageIntensity zneg1.nii.gz 0.02 0.98 128
 file zneg2.nii.gz does not exist .
./featureMatch.sh: line 22:  7324 Segmentation fault      ImageMath $dim zneg2.n                  ii.gz TruncateImageIntensity zneg2.nii.gz 0.02 0.98 128
./featureMatch.sh: line 23:  2712 Segmentation fault      MultiplyImages $dim zn                  eg1.nii.gz zmask1.nii.gz zneg1.nii.gz
./featureMatch.sh: line 24:  9208 Segmentation fault      MultiplyImages $dim zn                  eg2.nii.gz zmask2.nii.gz zneg2.nii.gz
 file zneg1.nii.gz does not exist .
 file zneg2.nii.gz does not exist .
 file zneg2.nii.gz does not exist .
 file zneg1.nii.gz does not exist .
./featureMatch.sh: line 30: 11148 Segmentation fault      MultiplyImages $dim zn                  eg1.nii.gz zmask1.nii.gz zneg1.nii.gz
./featureMatch.sh: line 31:  2004 Segmentation fault      MultiplyImages $dim zn                  eg2.nii.gz zmask2.nii.gz zneg2.nii.gz
 file zneg1.nii.gz does not exist .
./featureMatch.sh: line 32:  5356 Segmentation fault      ImageMath $dim zneg1.n                  ii.gz Normalize zneg1.nii.gz 1
 file zneg2.nii.gz does not exist .
./featureMatch.sh: line 33: 13492 Segmentation fault      ImageMath $dim zneg2.n                  ii.gz Normalize zneg2.nii.gz 1
 file zneg1.nii.gz does not exist .
C:\Users\DP\Desktop\ANTs210binary\ITKv4\Modules\ThirdParty\VNL\src\vxl\core\vnl/                  algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 3
C:\Users\DP\Desktop\ANTs210binary\ITKv4\Modules\ThirdParty\VNL\src\vxl\core\vnl/                  algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 3
C:\Users\DP\Desktop\ANTs210binary\ITKv4\Modules\ThirdParty\VNL\src\vxl\core\vnl/                  algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 3
 Rather than opening 1 as an image file, this program has decided, in its great                   wisdom, to consider it to be a floating point numerical value, and has acted acc                  ordingly -- i.e. read this as a number.
rm: cannot remove 'zneg*': No such file or directory

The log for running cars.sh (the newest version) is as follows:

$ ./cars.sh
All_Command_lines_OK
ANTs Version: 2.1.0@_GIT_VERSION_RC@.post@_GIT_VERSION_POST@-gGITDIR-NOTFOUND
Compiled: Feb 12 2015 17:54:52

ford.jpg : b2f_aff.nii.gz => MI -0.796768
 targetvalue 0 metricvalue -0.796768 diff -0.796768 toler 1e+020
 Failure? 0
 file b2f_diff.nii.gz does not exist .
./cars.sh: line 31:  6732 Segmentation fault      MeasureImageSimilarity $dim 2 $f b2f_diff.nii.gz log.txt
 Updated reader
 Dire in 1 0
0 1

 Dire out 1 0
0 1

./cars.sh: line 33: 11480 Segmentation fault      ConvertImagePixelType b2f_diff.nii.gz b2f_diff.jpg 1

For both of this two scripts, I found that the functions

antsRegistration

and

N3BiasFieldCorrection

all failed to output any nifti files, that's the reason which results in so many "do not exist" from the logs.

ntustison commented 7 years ago

In my earlier email I asked you to specifically run this script from the stnava/chicken repo. Were you able to run that example? Don't worry about the .jpg conversion issue for now.

sucv commented 7 years ago

Yes, it works perfectly. It output "pseChicken4xChicken3Warped.nii.gz" and "pseChicken4xChicken30GenericAffine.mat" for me.

So "antsRegistration -o ${outputPrefix}" defined the output directory, then "antsApplyTransforms -o ${outputPrefix}Warped.nii.gz" output the nifti images to the directory.

2017-06-19 18:42 GMT-07:00 Nick Tustison notifications@github.com:

In my earlier email I asked you to specifically run this script https://github.com/stnava/chicken/blob/master/antsRegistrationCommand.sh from the stnava/chicken repo. Were you able to run that example? Don't worry about the .jpg conversion issue for now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stnava/ANTs/issues/460#issuecomment-309620305, or mute the thread https://github.com/notifications/unsubscribe-auth/AcLJEH7n_CblEKubEiNJd1nCDiZRhchsks5sFyOSgaJpZM4N-Mef .

sucv commented 7 years ago

data.zip These are my data to run my experiment. Three pairs of binary jpg images are included, each of which are named as mov[i].jpg and fix[i].jpg, respectively.

From this script, I can register two chicken in nifti format rigidly. Nick suggest me to replace the metric option from PSE to JHCL and it works perfectly.

However, my data is jpg format. Based on Brian's comment, the cars.sh contains the example for conversion between jpg and nifti.

My questions: (i) Is the "b2f_0GenericAffine.mat" generated by using

antsAffineInitializer 2 chicken-4.jpg chicken-3.jpg chicken3to4.mat 10 0.3 0 10

just as in chicken README ?

(ii) The transformation model is "syn[ 0.25 , 3.0, 1 ]" when there exists "b2f_0GenericAffine.mat". I want to use "BSplineSyN" model since BSpline is employed in the literature. How to determine the parameters for BSplineSyN[]?

(iii) As shown in the logs, the files "b2f_diff.nii.gz" and "b2f_aff.nii.gz" cannot be generate. is it caused by my windows..?

sucv commented 7 years ago

My question above are based on cars.sh as follows.

dim=2
m=beetle.jpg ;  f=ford.jpg
if [ ! -s $f ] ; then no fixed $f ; exit 1 ; fi
if [ ! -s $m ] ; then no moving $m ; exit 1 ; fi
its=[1500x1500x1500x300x100x0,1.e-7,5]
its2=[200x200x200x200x150x50,0,5]
smth=5x4x3x2x1x0
down=7x6x5x4x2x1
tx=" syn[ 0.25 , 3.0, 1 ] "
if [[ ! -s b2f_0GenericAffine.mat ]] ; then
antsRegistration -d $dim \
                        -m Mattes[  $f, $m , 1,  20, Random, 0.2 ] \
                         -t affine[ 2.0 ]  \
                         -c $its  \
                        -s $smth  \
                        -f $down \
                       -u 1  -v 1  \
                       -o [b2f_,b2f_aff.nii.gz]
fi

#                        -m cc[  $f, $m , 1, 8 ] \
antsRegistration -d $dim -r [b2f_0GenericAffine.mat] \
                        -m Mattes[  $f, $m , 1,  32 ] \
                        -t $tx \
                        -c $its2  \
                        -s $smth  \
                        -f $down \
                       -u 1 -v 1 \
                       -o [b2f_,b2f_diff.nii.gz,b2f_diff_inv.nii.gz]
MeasureImageSimilarity $dim 2 $f b2f_aff.nii.gz log.txt
MeasureImageSimilarity $dim 2 $f b2f_diff.nii.gz log.txt
ConvertImagePixelType b2f_aff.nii.gz b2f_aff.jpg 1
ConvertImagePixelType b2f_diff.nii.gz b2f_diff.jpg 1
ntustison commented 7 years ago

My questions: (i) Is the "b2f_0GenericAffine.mat" generated by using

antsAffineInitializer 2 chicken-4.jpg chicken-3.jpg chicken3to4.mat 10 0.3 0 10

just as in chicken README ?

No. It's produced by the first antsRegistration call.

(ii) The transformation model is "syn[ 0.25 , 3.0, 1 ]" when there exists "b2f_0GenericAffine.mat". I want to use "BSplineSyN" model since BSpline is employed in the literature. How to determine the parameters for BSplineSyN[]?

Have you consulted the help ( antsRegistration --help )? Also, here is the paper.

(iii) As shown in the logs, the files "b2f_diff.nii.gz" and "b2f_aff.nii.gz" cannot be generate. is it caused by my windows..?

I don't know. I suggest you start with the example that works (antsRegistrationCommand.sh) and then go from there, i.e., convert your .jpg files to .nii.gz files.

sucv commented 7 years ago

From "cars.sh" and "antsRegistrationCommand.sh", I know that antsRegistration.exe supports both jpg and nifti images as the input. But here is the problem: the original "antsRegistrationCommand.sh" requires two nifti images as the input, so I turn to "cars.h". However, though it originally supports two jpg as the input, it fails to generate any nifti image. Sorry for post such stupid questions... it really confuses me >_<

2017-06-20 7:03 GMT-07:00 Nick Tustison notifications@github.com:

My questions: (i) Is the "b2f_0GenericAffine.mat" generated by using

antsAffineInitializer 2 chicken-4.jpg chicken-3.jpg chicken3to4.mat 10 0.3 0 10

just as in chicken README ?

No. It's produced by the first antsRegistration call.

(ii) The transformation model is "syn[ 0.25 , 3.0, 1 ]" when there exists "b2f_0GenericAffine.mat". I want to use "BSplineSyN" model since BSpline is employed in the literature. How to determine the parameters for BSplineSyN[]?

Have you consulted the help ( antsRegistration --help )? Also, here https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3870320/ is the paper.

(iii) As shown in the logs, the files "b2f_diff.nii.gz" and "b2f_aff.nii.gz" cannot be generate. is it caused by my windows..?

I don't know. I suggest you start with the example that works ( antsRegistrationCommand.sh) and then go from there, i.e., convert your .jpg files to .nii.gz files.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stnava/ANTs/issues/460#issuecomment-309764372, or mute the thread https://github.com/notifications/unsubscribe-auth/AcLJEPx5GgALw9rPQqkXEglrBbBhh1l6ks5sF9EZgaJpZM4N-Mef .

ntustison commented 7 years ago

As I said, convert your .jpg images to .nii.gz for use with antsRegistrationCommand.sh.

cookpa commented 7 years ago

For example,

ImageMath 2 beetle.nii.gz m beetle.jpg 1 
sucv commented 7 years ago

You mean I should convert my .jpg to .nii.gz manually by using other tools which are not provided in ANTs ?

2017-06-20 8:00 GMT-07:00 Nick Tustison notifications@github.com:

As I said, convert your .jpg images to .nii.gz for use with antsRegistrationCommand.sh.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stnava/ANTs/issues/460#issuecomment-309786253, or mute the thread https://github.com/notifications/unsubscribe-auth/AcLJEMpshAdwhhGe9vdUsyQvtrnVbDy7ks5sF959gaJpZM4N-Mef .

sucv commented 7 years ago

Thank Cook, this works !

2017-06-20 8:03 GMT-07:00 quicksilvery quicksilvery gcyyyyn@gmail.com:

You mean I should convert my .jpg to .nii.gz manually by using other tools which are not provided in ANTs ?

2017-06-20 8:00 GMT-07:00 Nick Tustison notifications@github.com:

As I said, convert your .jpg images to .nii.gz for use with antsRegistrationCommand.sh.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stnava/ANTs/issues/460#issuecomment-309786253, or mute the thread https://github.com/notifications/unsubscribe-auth/AcLJEMpshAdwhhGe9vdUsyQvtrnVbDy7ks5sF959gaJpZM4N-Mef .

sucv commented 7 years ago

Today, I successfully compiled, built and installed ITK4 and ANTs in my Ubuntu 16.04. However, the problems still persist. I mainly tested three scripts which are cars.sh, antsRegistration.sh and featureMatch.sh.

1) The following logs outputted when directly running these three scripts:

sora@sora:~/ants/bin/cars$ ./cars.sh
All_Command_lines_OK
ANTs Version: 2.1.0-g78931
Compiled: Jan 23 2015 08:20:31

ford.jpg : b2f_aff.nii.gz => MI -0.796768
 targetvalue 0 metricvalue -0.796768 diff -0.796768 toler 1e+20
 Failure? 0
 file b2f_diff.nii.gz does not exist . 
./cars.sh: line 31: 17499 Segmentation fault      (core dumped) MeasureImageSimilarity $dim 2 $f b2f_diff.nii.gz log.txt
 Updated reader 
 Dire in 1 0
0 1

 Dire out 1 0
0 1

./cars.sh: line 33: 17511 Segmentation fault      (core dumped) ConvertImagePixelType b2f_diff.nii.gz b2f_diff.jpg 1
sora@sora:~/ants/bin/cars$ 
sora@sora:~/ants/bin/featureMatching$ ./featureMatch.sh 2 data/mono1.jpg data/mono2.jpg 500 20 1
Lower quantile: 1.42822
Upper quantile: 279.33
Lower quantile: 1.31169
Upper quantile: 295.216
 Blob1Length 500 Blob2Length 500
 Progress : 0
 Progress : 20
 Progress : 40
 Progress : 60
 Progress : 80
 now compute pairwise matching 0.979806 reducing to 20
 best correlation 0.979806 rad1 2.46229 rad2 2.46229 : 1
 best correlation 0.976119 rad1 2.63902 rad2 2.63902 : 2
 best correlation 0.973352 rad1 2 rad2 1.86607 : 3
 best correlation 0.969476 rad1 2.63902 rad2 2.46229 : 4
 best correlation 0.967323 rad1 2.82843 rad2 2.63902 : 5
 best correlation 0.964185 rad1 2.63902 rad2 2.63902 : 6
 best correlation 0.96228 rad1 1.7411 rad2 1.6245 : 7
 best correlation 0.957258 rad1 2.14355 rad2 2.2974 : 8
 best correlation 0.955466 rad1 1.51572 rad2 1.7411 : 9
 best correlation 0.948655 rad1 2 rad2 1.86607 : 10
 best correlation 0.946579 rad1 2 rad2 1.86607 : 11
 best correlation 0.942339 rad1 2.82843 rad2 2.82843 : 12
 best correlation 0.937059 rad1 1.7411 rad2 1.7411 : 13
 best correlation 0.935795 rad1 1.51572 rad2 1.6245 : 14
 best correlation 0.929505 rad1 1.41421 rad2 1.51572 : 15
 best correlation 0.928898 rad1 2 rad2 2.14355 : 16
 best correlation 0.926458 rad1 1.86607 rad2 1.7411 : 17
 best correlation 0.918548 rad1 2.82843 rad2 2.63902 : 18
 best correlation 0.917155 rad1 3.03143 rad2 3.03143 : 19
 best correlation 0.917111 rad1 2.82843 rad2 3.03143 : 20
 blob 0 keep 0 0.967421 0.94847 0.949122 1 0.905 0.949856 0.944548 0.947063 0.95199 1.18033 0.955882 0.5 1.05663 0.934444 1 1 1 0.981132 0.980054
 blob 1 keep 0.967421 0 0.955567 0.9565 0.9536 1.01124 0.961585 0.932304 0.943719 0.951843 1.00976 1.0105 1.02253 0.995829 1.17241 0.968056 0.973781 0.969602 1 1
 blob 2 keep 0.94847 0.955567 0 1 0.94863 0.966602 1 1 1 1 0.974379 0.971154 0.974148 0.976306 0.960041 0.951574 0.960986 0.95484 0.94358 0.946939
 blob 3 keep 0.949122 0.9565 1 0 0.94928 0.967144 1 1 1 1 0.974703 0.971562 0.974476 0.976575 0.960804 0.952151 0.961362 0.955343 0.943119 0.942308
 blob 4 keep 1 0.9536 0.94863 0.94928 0 0.868293 0.950669 0.942159 0.945688 0.950619 2.5 0.702703 0.852459 1.08753 0.944398 1 1 1 0.976951 0.977141
 blob 5 keep 0.905 1.01124 0.966602 0.967144 0.868293 0 0.967636 0.963332 0.965572 0.969894 1 1 1 1 1 0.910769 0.947925 0.924214 1.00912 1.00513
 blob 6 keep 0.949856 0.961585 1 1 0.950669 0.967636 0 1 1 1 0.974666 0.971714 0.974047 0.976973 0.959201 0.952813 0.961819 0.955931 0.955882 0.954455
 blob 7 keep 0.944548 0.932304 1 1 0.942159 0.963332 1 0 1 1 0.973327 0.969312 0.974621 0.973852 0.970065 0.947883 0.958209 0.95144 0.984615 1.2027
 blob 8 keep 0.947063 0.943719 1 1 0.945688 0.965572 1 1 0 1 0.974339 0.970767 0.975029 0.975285 0.966126 0.950213 0.95989 0.953554 0.912752 1.06
 blob 9 keep 0.95199 0.951843 1 1 0.950619 0.969894 1 1 1 0 0.976915 0.97401 0.977628 0.977382 0.971029 0.954575 0.962727 0.957353 0.892704 0.82
 blob 10 keep 1.18033 1.00976 0.974379 0.974703 2.5 1 0.974666 0.973327 0.974339 0.976915 0 1 1 1 1 1.02778 0.91055 0.847222 1.00717 1.00469
 blob 11 keep 0.955882 1.0105 0.971154 0.971562 0.702703 1 0.971714 0.969312 0.970767 0.97401 1 0 1 1 1 0.884956 0.933165 0.892704 1.0079 1.00486
 blob 12 keep 0.5 1.02253 0.974148 0.974476 0.852459 1 0.974047 0.974621 0.975029 0.977628 1 1 0 1 1 0.702703 0.924668 0.841379 1.01089 1.00753
 blob 13 keep 1.05663 0.995829 0.976306 0.976575 1.08753 1 0.976973 0.973852 0.975285 0.977382 1 1 1 0 1 1.05647 0.974212 1.04691 1.00112 1.00013
 blob 14 keep 0.934444 1.17241 0.960041 0.960804 0.944398 1 0.959201 0.970065 0.966126 0.971029 1 1 1 1 0 0.943673 0.963967 0.951814 1.03354 1.02185
 blob 15 keep 1 0.968056 0.951574 0.952151 1 0.910769 0.952813 0.947883 0.950213 0.954575 1.02778 0.884956 0.702703 1.05647 0.943673 0 1 1 0.981486 0.980755
 blob 16 keep 1 0.973781 0.960986 0.961362 1 0.947925 0.961819 0.958209 0.95989 0.962727 0.91055 0.933165 0.924668 0.974212 0.963967 1 0 1 0.98346 0.983386
 blob 17 keep 1 0.969602 0.95484 0.955343 1 0.924214 0.955931 0.95144 0.953554 0.957353 0.847222 0.892704 0.841379 1.04691 0.951814 1 1 0 0.982026 0.981586
 blob 18 keep 0.981132 1 0.94358 0.943119 0.976951 1.00912 0.955882 0.984615 0.912752 0.892704 1.00717 1.0079 1.01089 1.00112 1.03354 0.981486 0.98346 0.982026 0 1
 blob 19 keep 0.980054 1 0.946939 0.942308 0.977141 1.00513 0.954455 1.2027 1.06 0.82 1.00469 1.00486 1.00753 1.00013 1.02185 0.980755 0.983386 0.981586 1 0
 Matched 21 blobs 
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 3
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 3
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 3
 Rather than opening 1 as an image file, this program has decided, in its great wisdom, to consider it to be a floating point numerical value, and has acted accordingly -- i.e. read this as a number. 
sora@sora:~/ants/bin/featureMatching$ 
sora@sora:~/ants/bin/chicken$ ./antsRegistrationCommand.sh 
All_Command_lines_OK
Using double precision for computations.
=============================================================================
The composite transform comprises the following transforms (in order): 
  1. Center of mass alignment using fixed image: data/chicken-4.nii.gz and moving image: data/chicken-3.nii.gz (type = Euler2DTransform)
=============================================================================
  number of levels = 1
  number of levels = 1
  number of levels = 1
  fixed point set: data/chicken-4.nii.gz
  moving point set: data/chicken-3.nii.gz
  fixed point set: data/chicken-4.nii.gz
  moving point set: data/chicken-3.nii.gz
  fixed point set: data/chicken-4.nii.gz
  moving point set: data/chicken-3.nii.gz
Dimension = 2
Number of stages = 3
Use Histogram Matching false
Winsorize image intensities false
Lower quantile = 0
Upper quantile = 1
Stage 1 State
   Point Set Metric = PSE
     Fixed point set = PointSet (0x45b8b50)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 20680
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 9666
  RealTimeStamp: 0 seconds 
  Number Of Points: 189
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x45bcad0
  Size of Point Data Container: 189

     Moving point set = PointSet (0x45b5320)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 20681
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 20678
  RealTimeStamp: 0 seconds 
  Number Of Points: 242
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x45b8c30
  Size of Point Data Container: 242

     Weighting = 1
     Use only boundary points = true
     Point set sigma = 20
     Evaluation K neighborhood = 10
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 0.1
   Transform = Affine
     Gradient step = 0.1
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Stage 2 State
   Point Set Metric = PSE
     Fixed point set = PointSet (0x45b6fa0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 39762
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 28720
  RealTimeStamp: 0 seconds 
  Number Of Points: 185
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x45b7080
  Size of Point Data Container: 185

     Moving point set = PointSet (0x45e83a0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 39763
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 39760
  RealTimeStamp: 0 seconds 
  Number Of Points: 249
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x45e5a20
  Size of Point Data Container: 249

     Weighting = 1
     Use only boundary points = true
     Point set sigma = 10
     Evaluation K neighborhood = 10
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 0.1
   Transform = Affine
     Gradient step = 0.1
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Stage 3 State
   Point Set Metric = PSE
     Fixed point set = PointSet (0x45b7520)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 58804
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 47686
  RealTimeStamp: 0 seconds 
  Number Of Points: 156
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x45b7600
  Size of Point Data Container: 156

     Moving point set = PointSet (0x45e75d0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 58805
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 58802
  RealTimeStamp: 0 seconds 
  Number Of Points: 268
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x45e8620
  Size of Point Data Container: 268

     Weighting = 1
     Use only boundary points = true
     Point set sigma = 5
     Evaluation K neighborhood = 10
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 0.1
   Transform = Affine
     Gradient step = 0.1
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Registration using 3 total stages.

Stage 0
  iterations = 50
  convergence threshold = 0
  convergence window size = 10
  number of levels = 1
  Shrink factors (level 1 out of 1): [1, 1]
  smoothing sigmas per level: [0]
  Using default NONE metricSamplingStrategy 

*** Running affine registration ***

DIAGNOSTIC,Iteration,metricValue,convergenceValue,ITERATION_TIME_INDEX,SINCE_LAST
 2DIAGNOSTIC,     1, -6.854572691139e-02, 1.797693134862e+308, 1.4990e-02, 1.4990e-02, 
 2DIAGNOSTIC,     2, -6.860642265861e-02, 1.797693134862e+308, 2.6070e-02, 1.1080e-02, 
 2DIAGNOSTIC,     3, -6.870856085666e-02, 1.797693134862e+308, 3.7758e-02, 1.1688e-02, 
 2DIAGNOSTIC,     4, -6.888292933181e-02, 1.797693134862e+308, 4.9085e-02, 1.1327e-02, 
 2DIAGNOSTIC,     5, -6.918345771693e-02, 1.797693134862e+308, 6.0244e-02, 1.1159e-02, 
 2DIAGNOSTIC,     6, -6.969366702581e-02, 1.797693134862e+308, 7.1972e-02, 1.1728e-02, 
 2DIAGNOSTIC,     7, -7.055062341181e-02, 1.797693134862e+308, 8.3279e-02, 1.1307e-02, 
 2DIAGNOSTIC,     8, -7.200345275383e-02, 1.797693134862e+308, 9.4392e-02, 1.1113e-02, 
 2DIAGNOSTIC,     9, -7.437692998877e-02, 1.797693134862e+308, 1.0558e-01, 1.1188e-02, 
 2DIAGNOSTIC,    10, -7.817593572819e-02, 7.157451325487e-03, 1.1805e-01, 1.2473e-02, 
 2DIAGNOSTIC,    11, -8.399736626325e-02, 1.038922761773e-02, 1.2814e-01, 1.0091e-02, 
 2DIAGNOSTIC,    12, -9.232387234183e-02, 1.463040520632e-02, 1.3759e-01, 9.4461e-03, 
 2DIAGNOSTIC,    13, -1.019227402594e-01, 1.936560262758e-02, 1.4949e-01, 1.1904e-02, 
 2DIAGNOSTIC,    14, -1.115069087439e-01, 2.380156445140e-02, 1.5913e-01, 9.6369e-03, 
 2DIAGNOSTIC,    15, -1.126375290751e-01, 2.559543200771e-02, 1.6874e-01, 9.6071e-03, 
 2DIAGNOSTIC,    16, -1.136392532796e-01, 2.512648136616e-02, 1.7822e-01, 9.4860e-03, 
 2DIAGNOSTIC,    17, -1.170312978466e-01, 2.325120346930e-02, 1.8986e-01, 1.1641e-02, 
 2DIAGNOSTIC,    18, -1.178961120330e-01, 1.992479792524e-02, 1.9945e-01, 9.5809e-03, 
 2DIAGNOSTIC,    19, -1.191445912027e-01, 1.584356029401e-02, 2.1567e-01, 1.6221e-02, 
 2DIAGNOSTIC,    20, -1.205945781849e-01, 1.168616762273e-02, 2.2490e-01, 9.2299e-03, 
 2DIAGNOSTIC,    21, -1.260710140357e-01, 8.625591978891e-03, 2.3450e-01, 9.6040e-03, 
 2DIAGNOSTIC,    22, -1.292412501079e-01, 6.686702219247e-03, 2.4746e-01, 1.2962e-02, 
 2DIAGNOSTIC,    23, -1.321946376203e-01, 5.951193035474e-03, 2.7697e-01, 2.9503e-02, 
 2DIAGNOSTIC,    24, -1.321950575627e-01, 5.931117486961e-03, 2.8852e-01, 1.1552e-02, 
 2DIAGNOSTIC,    25, -1.322235783848e-01, 5.506097544205e-03, 2.9837e-01, 9.8491e-03, 
 2DIAGNOSTIC,    26, -1.322725617792e-01, 4.714913200844e-03, 3.0764e-01, 9.2721e-03, 
 2DIAGNOSTIC,    27, -1.323602582914e-01, 3.918543821291e-03, 3.1725e-01, 9.6090e-03, 
 2DIAGNOSTIC,    28, -1.324932235120e-01, 2.930931949542e-03, 3.2709e-01, 9.8410e-03, 
 2DIAGNOSTIC,    29, -1.327181620232e-01, 1.903522949653e-03, 3.3654e-01, 9.4540e-03, 
 2DIAGNOSTIC,    30, -1.330687266512e-01, 9.428615362767e-04, 3.4590e-01, 9.3570e-03, 
 2DIAGNOSTIC,    31, -1.342104286676e-01, 5.461328387741e-04, 3.5504e-01, 9.1431e-03, 
 2DIAGNOSTIC,    32, -1.362659447091e-01, 5.589771269732e-04, 3.6733e-01, 1.2287e-02, 
 2DIAGNOSTIC,    33, -1.370295807464e-01, 8.147685758073e-04, 3.7929e-01, 1.1964e-02, 
 2DIAGNOSTIC,    34, -1.374870709908e-01, 1.011474406712e-03, 3.8848e-01, 9.1832e-03, 
 2DIAGNOSTIC,    35, -1.377767542200e-01, 1.123853604723e-03, 4.0318e-01, 1.4700e-02, 
 2DIAGNOSTIC,    36, -1.382322319015e-01, 1.157453021548e-03, 4.1259e-01, 9.4099e-03, 
 2DIAGNOSTIC,    37, -1.384256106065e-01, 1.096227956799e-03, 4.2412e-01, 1.1530e-02, 
 2DIAGNOSTIC,    38, -1.384934388494e-01, 9.487854065857e-04, 4.3438e-01, 1.0261e-02, 
 2DIAGNOSTIC,    39, -1.409966522556e-01, 9.007710980945e-04, 4.5149e-01, 1.7109e-02, 
 2DIAGNOSTIC,    40, -1.423733891855e-01, 8.748735797818e-04, 4.6836e-01, 1.6876e-02, 
 2DIAGNOSTIC,    41, -1.424363620064e-01, 8.377650828496e-04, 4.7759e-01, 9.2292e-03, 
 2DIAGNOSTIC,    42, -1.425024128489e-01, 8.517996644210e-04, 4.8675e-01, 9.1538e-03, 
 2DIAGNOSTIC,    43, -1.425970329006e-01, 8.341109459431e-04, 4.9680e-01, 1.0054e-02, 
 2DIAGNOSTIC,    44, -1.427459438825e-01, 7.694337572760e-04, 5.0596e-01, 9.1639e-03, 
 2DIAGNOSTIC,    45, -1.427858255366e-01, 6.506611558749e-04, 5.3379e-01, 2.7831e-02, 
 2DIAGNOSTIC,    46, -1.427860680877e-01, 5.021835401870e-04, 5.4309e-01, 9.2969e-03, 
 2DIAGNOSTIC,    47, -1.427877536526e-01, 3.263635840907e-04, 5.5227e-01, 9.1760e-03, 
 2DIAGNOSTIC,    48, -1.427903952237e-01, 1.290771183648e-04, 5.6221e-01, 9.9399e-03, 
 2DIAGNOSTIC,    49, -1.427941205108e-01, 5.050644606976e-05, 5.7135e-01, 9.1410e-03, 
 2DIAGNOSTIC,    50, -1.427994746079e-01, 3.719986248324e-05, 5.8057e-01, 9.2230e-03, 
  Elapsed time (stage 0): 5.8283e-01

Stage 1
  iterations = 40
  convergence threshold = 0.0000e+00
  convergence window size = 10
  number of levels = 1
  Shrink factors (level 1 out of 1): [1, 1]
  smoothing sigmas per level: [0]
  Using default NONE metricSamplingStrategy 

*** Running affine registration ***

DIAGNOSTIC,Iteration,metricValue,convergenceValue,ITERATION_TIME_INDEX,SINCE_LAST
 2DIAGNOSTIC,     1, -1.530102520413e-01, 1.797693134862e+308, 1.1413e-02, 1.1413e-02, 
 2DIAGNOSTIC,     2, -1.532755634377e-01, 1.797693134862e+308, 1.9789e-02, 8.3761e-03, 
 2DIAGNOSTIC,     3, -1.536971218212e-01, 1.797693134862e+308, 2.8164e-02, 8.3749e-03, 
 2DIAGNOSTIC,     4, -1.543530433233e-01, 1.797693134862e+308, 3.6523e-02, 8.3590e-03, 
 2DIAGNOSTIC,     5, -1.552567573407e-01, 1.797693134862e+308, 4.5609e-02, 9.0859e-03, 
 2DIAGNOSTIC,     6, -1.563456242624e-01, 1.797693134862e+308, 5.3955e-02, 8.3461e-03, 
 2DIAGNOSTIC,     7, -1.572731180299e-01, 1.797693134862e+308, 6.4545e-02, 1.0590e-02, 
 2DIAGNOSTIC,     8, -1.575824711591e-01, 1.797693134862e+308, 8.0321e-02, 1.5776e-02, 
 2DIAGNOSTIC,     9, -1.575924746524e-01, 1.797693134862e+308, 9.0872e-02, 1.0551e-02, 
 2DIAGNOSTIC,    10, -1.575953001164e-01, 2.306847274120e-03, 1.0554e-01, 1.4667e-02, 
 2DIAGNOSTIC,    11, -1.575960315398e-01, 1.864475110795e-03, 1.1495e-01, 9.4090e-03, 
 2DIAGNOSTIC,    12, -1.575969609866e-01, 1.368533974127e-03, 1.2650e-01, 1.1549e-02, 
 2DIAGNOSTIC,    13, -1.575975129091e-01, 8.855008208130e-04, 1.3884e-01, 1.2347e-02, 
 2DIAGNOSTIC,    14, -1.575976195912e-01, 4.771679654970e-04, 1.5710e-01, 1.8254e-02, 
 2DIAGNOSTIC,    15, -1.575976405931e-01, 1.879857201998e-04, 1.6912e-01, 1.2027e-02, 
 2DIAGNOSTIC,    16, -1.575976392337e-01, 3.916202071132e-05, 1.7905e-01, 9.9289e-03, 
 2DIAGNOSTIC,    17, -1.575976434190e-01, 2.595533632965e-06, 1.9057e-01, 1.1518e-02, 
 2DIAGNOSTIC,    18, -1.575976577913e-01, 1.091627249206e-06, 2.0297e-01, 1.2398e-02, 
 2DIAGNOSTIC,    19, -1.575976574269e-01, 6.158017699931e-07, 2.1468e-01, 1.1713e-02, 
 2DIAGNOSTIC,    20, -1.575976528513e-01, 4.053891367317e-07, 2.2621e-01, 1.1525e-02, 
 2DIAGNOSTIC,    21, -1.575976521781e-01, 2.569253492735e-07, 2.3848e-01, 1.2270e-02, 
 2DIAGNOSTIC,    22, -1.575976573680e-01, 1.910667113691e-07, 2.5010e-01, 1.1621e-02, 
 2DIAGNOSTIC,    23, -1.575976522576e-01, 1.723338927187e-07, 2.6167e-01, 1.1571e-02, 
 2DIAGNOSTIC,    24, -1.575976565739e-01, 1.630775060130e-07, 2.7381e-01, 1.2145e-02, 
 2DIAGNOSTIC,    25, -1.575976587175e-01, 1.560260544445e-07, 2.8554e-01, 1.1725e-02, 
 2DIAGNOSTIC,    26, -1.575976553323e-01, 1.490026973749e-07, 2.9710e-01, 1.1562e-02, 
 2DIAGNOSTIC,    27, -1.575976592463e-01, 1.429377763582e-07, 3.0967e-01, 1.2566e-02, 
 2DIAGNOSTIC,    28, -1.575976537728e-01, 1.378444691447e-07, 3.2126e-01, 1.1590e-02, 
 2DIAGNOSTIC,    29, -1.575976571954e-01, 1.332798701820e-07, 3.3283e-01, 1.1570e-02, 
 2DIAGNOSTIC,    30, -1.575976461769e-01, 1.280187164540e-07, 3.4443e-01, 1.1599e-02, 
 2DIAGNOSTIC,    31, -1.575976559480e-01, 1.236644287597e-07, 3.5594e-01, 1.1514e-02, 
 2DIAGNOSTIC,    32, -1.575976515991e-01, 1.196661460340e-07, 3.6885e-01, 1.2912e-02, 
 2DIAGNOSTIC,    33, -1.575976522770e-01, 1.157204625596e-07, 3.7942e-01, 1.0566e-02, 
 2DIAGNOSTIC,    34, -1.575976475696e-01, 1.120710837188e-07, 3.9108e-01, 1.1663e-02, 
 2DIAGNOSTIC,    35, -1.575976369724e-01, 1.083085964734e-07, 4.0649e-01, 1.5408e-02, 
 2DIAGNOSTIC,    36, -1.575976438422e-01, 1.050829897438e-07, 4.1936e-01, 1.2875e-02, 
 2DIAGNOSTIC,    37, -1.575976453002e-01, 1.024440664035e-07, 4.3216e-01, 1.2791e-02, 
 2DIAGNOSTIC,    38, -1.575976474664e-01, 9.991999014997e-08, 4.4508e-01, 1.2922e-02, 
 2DIAGNOSTIC,    39, -1.575976420390e-01, 9.757886030790e-08, 4.5685e-01, 1.1774e-02, 
 2DIAGNOSTIC,    40, -1.575976428547e-01, 9.499198079868e-08, 4.7157e-01, 1.4719e-02, 
  Elapsed time (stage 1): 4.7341e-01

Stage 2
  iterations = 20
  convergence threshold = 0.0000e+00
  convergence window size = 10
  number of levels = 1
  Shrink factors (level 1 out of 1): [1, 1]
  smoothing sigmas per level: [0]
  Using default NONE metricSamplingStrategy 

*** Running affine registration ***

DIAGNOSTIC,Iteration,metricValue,convergenceValue,ITERATION_TIME_INDEX,SINCE_LAST
 2DIAGNOSTIC,     1, -1.185040576231e-01, 1.797693134862e+308, 1.1374e-02, 1.1374e-02, 
 2DIAGNOSTIC,     2, -1.187632264071e-01, 1.797693134862e+308, 1.9013e-02, 7.6392e-03, 
 2DIAGNOSTIC,     3, -1.191558105816e-01, 1.797693134862e+308, 2.8478e-02, 9.4650e-03, 
 2DIAGNOSTIC,     4, -1.197019635194e-01, 1.797693134862e+308, 3.6317e-02, 7.8392e-03, 
 2DIAGNOSTIC,     5, -1.203640402355e-01, 1.797693134862e+308, 4.5161e-02, 8.8439e-03, 
 2DIAGNOSTIC,     6, -1.210163486886e-01, 1.797693134862e+308, 5.2988e-02, 7.8270e-03, 
 2DIAGNOSTIC,     7, -1.216272363917e-01, 1.797693134862e+308, 6.2117e-02, 9.1288e-03, 
 2DIAGNOSTIC,     8, -1.224764939120e-01, 1.797693134862e+308, 7.0214e-02, 8.0972e-03, 
 2DIAGNOSTIC,     9, -1.239174943868e-01, 1.797693134862e+308, 1.1773e-01, 4.7517e-02, 
 2DIAGNOSTIC,    10, -1.239174081813e-01, 3.114992433008e-03, 1.3986e-01, 2.2133e-02, 
 2DIAGNOSTIC,    11, -1.239174007220e-01, 2.848261552453e-03, 1.5288e-01, 1.3013e-02, 
 2DIAGNOSTIC,    12, -1.239174040522e-01, 2.425229004594e-03, 1.6378e-01, 1.0904e-02, 
 2DIAGNOSTIC,    13, -1.239174021358e-01, 1.917036617979e-03, 1.7462e-01, 1.0841e-02, 
 2DIAGNOSTIC,    14, -1.239174002909e-01, 1.395109015688e-03, 1.8575e-01, 1.1132e-02, 
 2DIAGNOSTIC,    15, -1.239174041991e-01, 9.191404281351e-04, 1.9865e-01, 1.2893e-02, 
 2DIAGNOSTIC,    16, -1.239174041991e-01, 5.166876541090e-04, 2.1403e-01, 1.5382e-02, 
 2DIAGNOSTIC,    17, -1.239174041991e-01, 1.974000488984e-04, 2.2497e-01, 1.0936e-02, 
 2DIAGNOSTIC,    18, -1.239174023648e-01, 2.037308580380e-07, 2.3667e-01, 1.1703e-02, 
 2DIAGNOSTIC,    19, -1.239174007837e-01, 2.037573378841e-07, 2.4796e-01, 1.1295e-02, 
 2DIAGNOSTIC,    20, -1.239174007837e-01, 1.938452591291e-07, 2.5877e-01, 1.0805e-02, 
  Elapsed time (stage 2): 2.6003e-01

Total elapsed time: 1.3174e+00
Using double precision for computations.
Input scalar image: data/chicken-3.nii.gz
Reference image: data/chicken-4.nii.gz
=============================================================================
The composite transform comprises the following transforms (in order): 
  1. .//pseChicken4xChicken30GenericAffine.mat (type = AffineTransform)
=============================================================================
Default pixel value: 0
Interpolation type: NearestNeighborInterpolateImageFunction
Output warped image: .//pseChicken4xChicken3Warped.nii.gz
sora@sora:~/ants/bin/chicken$ 
sucv commented 7 years ago

According to cars logs, we can see that cars failed to generate b2f_diff.nii.gz. Actually, if I rename b2f_aff.nii.gz (e.g., as b2f_aff2.nii.gz) which is originally included in cars folder, I will get the following logs:

sora@sora:~/ants/bin/cars$ ./cars.sh
All_Command_lines_OK
ANTs Version: 2.1.0-g78931
Compiled: Jan 23 2015 08:20:31

 file b2f_aff.nii.gz does not exist . 
./cars.sh: line 30: 23037 Segmentation fault      (core dumped) MeasureImageSimilarity $dim 2 $f b2f_aff.nii.gz log.txt
 file b2f_diff.nii.gz does not exist . 
./cars.sh: line 31: 23039 Segmentation fault      (core dumped) MeasureImageSimilarity $dim 2 $f b2f_diff.nii.gz log.txt
./cars.sh: line 32: 23041 Segmentation fault      (core dumped) ConvertImagePixelType b2f_aff.nii.gz b2f_aff.jpg 1
./cars.sh: line 33: 23045 Segmentation fault      (core dumped) ConvertImagePixelType b2f_diff.nii.gz b2f_diff.jpg 1
sora@sora:~/ants/bin/cars$ 

Conclusion: cars.sh cannot generate nifti images normally. Why? What if you run it on your own computer? is it normal ?

ntustison commented 7 years ago

MeasureImageSimilarity was changed recently to not output images. Just comment out those lines.

sucv commented 7 years ago

Following cookpa's comment, I convert two binary images mov1.png and fix1.png to nifti format by using command

ImageMath 2 mov1.nii.gz m mov1.png 1
ImageMath 2 fix1.nii.gz m fix1.png 1

so I have

mov1.jpg fix1.jpg
mov1.png  fix1.png (a pair of binary image which is same as chicken-3 and 4 )
mov1.nii.gz fix1.nii.gz (a pair of binary image which is same as chicken-3 and 4 )

Then I tried the three script using my data. dataJpgPngNifti.zip

For cars.sh, I amended only the input

dim=2
m=mov1.jpg   f= fix1.jpg
if [ ! -s $f ] ; then no fixed $f ; exit 1 ; fi
if [ ! -s $m ] ; then no moving $m ; exit 1 ; fi
its=[1500x1500x1500x300x100x0,1.e-7,5]
its2=[200x200x200x200x150x50,0,5]
smth=5x4x3x2x1x0
down=7x6x5x4x2x1
tx=" syn[ 0.25 , 3.0, 1 ] "
if [[ ! -s b2f_0GenericAffine.mat ]] ; then
antsRegistration -d $dim \
                        -m Mattes[  $f, $m , 1,  20, Random, 0.2 ] \
                         -t affine[ 2.0 ]  \
                         -c $its  \
                        -s $smth  \
                        -f $down \
                       -u 1  -v 1  \
                       -o [b2f_,b2f_aff.nii.gz]
fi

#                        -m cc[  $f, $m , 1, 8 ] \
antsRegistration -d $dim -r [b2f_0GenericAffine.mat] \
                        -m Mattes[  $f, $m , 1,  32 ] \

and then ran it

sora@sora:~/ants/bin/cars$ ./cars.sh
All_Command_lines_OK
ANTs Version: 2.1.0-g78931
Compiled: Jan 23 2015 08:20:31

 file b2f_aff.nii.gz does not exist . 
./cars.sh: line 30: 23973 Segmentation fault      (core dumped) MeasureImageSimilarity $dim 2 $f b2f_aff.nii.gz log.txt
 file b2f_diff.nii.gz does not exist . 
./cars.sh: line 31: 23975 Segmentation fault      (core dumped) MeasureImageSimilarity $dim 2 $f b2f_diff.nii.gz log.txt
./cars.sh: line 32: 23977 Segmentation fault      (core dumped) ConvertImagePixelType b2f_aff.nii.gz b2f_aff.jpg 1
./cars.sh: line 33: 23979 Segmentation fault      (core dumped) ConvertImagePixelType b2f_diff.nii.gz b2f_diff.jpg 1
sora@sora:~/ants/bin/cars$ 

I tried command

./featureMatch.sh 2 data/mov1.jpg data/fix1.jpg 500 20 1
./featureMatch.sh 2 data/mov1.png data/fix1.png 500 20 1
./featureMatch.sh 2 data/mov1.nii.gz data/fix1.nii.gz 400 20 1

and respectively obtained

sora@sora:~/ants/bin/featureMatching$ ./featureMatch.sh 2 data/mov1.jpg data/fix1.jpg 500 20 1
Lower quantile: 3.00509
Upper quantile: 255.685
Lower quantile: 2.99475
Upper quantile: 256.411
 Blob1Length 500 Blob2Length 500
 Progress : 0
 Progress : 20
 Progress : 40
 Progress : 60
 Progress : 80
 now compute pairwise matching 0.782069 reducing to 20
 best correlation 0.782069 rad1 1.86607 rad2 1.7411 : 1
 best correlation 0.660815 rad1 1.86607 rad2 1.86607 : 2
 best correlation 0.593022 rad1 1.6245 rad2 1.7411 : 3
 best correlation 0.556235 rad1 2.14355 rad2 2 : 4
 best correlation 0.553366 rad1 1.86607 rad2 1.6245 : 5
 best correlation 0.519113 rad1 1.86607 rad2 1.7411 : 6
 best correlation 0.511552 rad1 1.6245 rad2 1.86607 : 7
 best correlation 0.491747 rad1 2.14355 rad2 2 : 8
 best correlation 0.467444 rad1 1.51572 rad2 1.7411 : 9
 best correlation 0.454476 rad1 1.7411 rad2 1.7411 : 10
 best correlation 0.42255 rad1 1.86607 rad2 1.6245 : 11
 best correlation 0.41983 rad1 1.86607 rad2 1.86607 : 12
 best correlation 0.415804 rad1 1.41421 rad2 1.41421 : 13
 best correlation 0.412675 rad1 1.41421 rad2 1.6245 : 14
 best correlation 0.408915 rad1 1.86607 rad2 1.7411 : 15
 best correlation 0.400457 rad1 1.86607 rad2 1.86607 : 16
 best correlation 0.39sora@sora:~/ants/bin/featureMatching$ ./featureMatch.sh 2 data/mov1.png data/fix1.png 500 20 1
Lower quantile: 0.994874
Upper quantile: 1.05436
Lower quantile: 0.997327
Upper quantile: 1.05598
 Blob1Length 500 Blob2Length 500
 Progress : 0
 Progress : 20
 Progress : 40
 Progress : 60
 Progress : 80
 now compute pairwise matching 0.478201 reducing to 20
 best correlation 0.478201 rad1 1.86607 rad2 1.7411 : 1
 best correlation 0.44092 rad1 1.7411 rad2 1.86607 : 2
 best correlation 0.41393 rad1 1.86607 rad2 1.86607 : 3
 best correlation 0.409359 rad1 1.6245 rad2 1.51572 : 4
 best correlation 0.394068 rad1 1.6245 rad2 1.86607 : 5
 best correlation 0.365817 rad1 2.46229 rad2 2.46229 : 6
 best correlation 0.335885 rad1 2 rad2 1.86607 : 7
 best correlation 0.331234 rad1 1.86607 rad2 1.6245 : 8
 best correlation 0.283876 rad1 1.86607 rad2 1.7411 : 9
 best correlation 0.282924 rad1 1.7411 rad2 1.86607 : 10
 best correlation 0.277997 rad1 2 rad2 1.86607 : 11
 best correlation 0.27029 rad1 2.63902 rad2 2.63902 : 12
 best correlation 0.269356 rad1 1.86607 rad2 2 : 13
 best correlation 0.266482 rad1 1.41421 rad2 1.6245 : 14
 best correlation 0.261139 rad1 1.86607 rad2 1.7411 : 15
 best correlation 0.247356 rad1 1.6245 rad2 1.86607 : 16
 best correlation 0.228 rad1 1.86607 rad2 1.86607 : 17
 best correlation 0.211419 rad1 1.86607 rad2 1.86607 : 18
 best correlation 0.203994 rad1 1.86607 rad2 1.86607 : 19
 best correlation 0.20033 rad1 1.6245 rad2 1.7411 : 20
 Matched 21 blobs 
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
HDF5-DIAG: Error detected in HDF5 (1.8.7) thread 0:
  #000: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5F.c line 794 in H5Fis_hdf5(): unable to open file
    major: Low-level I/O
    minor: Unable to initialize object
  #001: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FD.c line 1086 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #002: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDsec2.c line 348 in H5FD_sec2_open(): unable to open file: name = 'zMatchedAffine.txt', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
    major: File accessability
    minor: Unable to open file
 Rather than opening 1 as an image file, this program has decided, in its great wisdom, to consider it to be a floating point numerical value, and has acted accordingly -- i.e. read this as a number. 
rm: cannot remove 'z*ffine.txt': No such file or directory
sora@sora:~/ants/bin/featureMatching$ 3607 rad1 1.86607 rad2 1.7411 : 17
 best correlation 0.385197 rad1 2.46229 rad2 2.46229 : 18
 best correlation 0.384454 rad1 1.7411 rad2 1.6245 : 19
 best correlation 0.38035 rad1 2.14355 rad2 2.2974 : 20
 Matched 21 blobs 
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
HDF5-DIAG: Error detected in HDF5 (1.8.7) thread 0:
  #000: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5F.c line 794 in H5Fis_hdf5(): unable to open file
    major: Low-level I/O
    minor: Unable to initialize object
  #001: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FD.c line 1086 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #002: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDsec2.c line 348 in H5FD_sec2_open(): unable to open file: name = 'zMatchedAffine.txt', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
    major: File accessability
    minor: Unable to open file
 Rather than opening 1 as an image file, this program has decided, in its great wisdom, to consider it to be a floating point numerical value, and has acted accordingly -- i.e. read this as a number. 
rm: cannot remove 'z*ffine.txt': No such file or directory
sora@sora:~/ants/bin/featureMatching$ 
sora@sora:~/ants/bin/featureMatching$ ./featureMatch.sh 2 data/mov1.png data/fix1.png 500 20 1
Lower quantile: 0.994874
Upper quantile: 1.05436
Lower quantile: 0.997327
Upper quantile: 1.05598
 Blob1Length 500 Blob2Length 500
 Progress : 0
 Progress : 20
 Progress : 40
 Progress : 60
 Progress : 80
 now compute pairwise matching 0.478201 reducing to 20
 best correlation 0.478201 rad1 1.86607 rad2 1.7411 : 1
 best correlation 0.44092 rad1 1.7411 rad2 1.86607 : 2
 best correlation 0.41393 rad1 1.86607 rad2 1.86607 : 3
 best correlation 0.409359 rad1 1.6245 rad2 1.51572 : 4
 best correlation 0.394068 rad1 1.6245 rad2 1.86607 : 5
 best correlation 0.365817 rad1 2.46229 rad2 2.46229 : 6
 best correlation 0.335885 rad1 2 rad2 1.86607 : 7
 best correlation 0.331234 rad1 1.86607 rad2 1.6245 : 8
 best correlation 0.283876 rad1 1.86607 rad2 1.7411 : 9
 best correlation 0.282924 rad1 1.7411 rad2 1.86607 : 10
 best correlation 0.277997 rad1 2 rad2 1.86607 : 11
 best correlation 0.27029 rad1 2.63902 rad2 2.63902 : 12
 best correlation 0.269356 rad1 1.86607 rad2 2 : 13
 best correlation 0.266482 rad1 1.41421 rad2 1.6245 : 14
 best correlation 0.261139 rad1 1.86607 rad2 1.7411 : 15
 best correlation 0.247356 rad1 1.6245 rad2 1.86607 : 16
 best correlation 0.228 rad1 1.86607 rad2 1.86607 : 17
 best correlation 0.211419 rad1 1.86607 rad2 1.86607 : 18
 best correlation 0.203994 rad1 1.86607 rad2 1.86607 : 19
 best correlation 0.20033 rad1 1.6245 rad2 1.7411 : 20
 Matched 21 blobs 
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
HDF5-DIAG: Error detected in HDF5 (1.8.7) thread 0:
  #000: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5F.c line 794 in H5Fis_hdf5(): unable to open file
    major: Low-level I/O
    minor: Unable to initialize object
  #001: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FD.c line 1086 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #002: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDsec2.c line 348 in H5FD_sec2_open(): unable to open file: name = 'zMatchedAffine.txt', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
    major: File accessability
    minor: Unable to open file
 Rather than opening 1 as an image file, this program has decided, in its great wisdom, to consider it to be a floating point numerical value, and has acted accordingly -- i.e. read this as a number. 
rm: cannot remove 'z*ffine.txt': No such file or directory
sora@sora:~/ants/bin/featureMatching$ 
sora@sora:~/ants/bin/featureMatching$ ./featureMatch.sh 2 data/mov1.nii.gz data/fix1.nii.gz 400 20 1
Lower quantile: 1.00308
Upper quantile: 1.01673
Lower quantile: 0.0345397
Upper quantile: 2.9573
 Blob1Length 400 Blob2Length 400
 Progress : 0
 Progress : 25
 Progress : 50
 Progress : 75
 now compute pairwise matching 0.670233 reducing to 20
 best correlation 0.670233 rad1 1.86607 rad2 1.86607 : 1
 best correlation 0.44733 rad1 1.86607 rad2 1.6245 : 2
 best correlation 0.446861 rad1 1.7411 rad2 1.7411 : 3
 best correlation 0.432106 rad1 1.86607 rad2 1.86607 : 4
 best correlation 0.380275 rad1 1.6245 rad2 1.51572 : 5
 best correlation 0.365524 rad1 2.14355 rad2 2.2974 : 6
 best correlation 0.352095 rad1 1.7411 rad2 1.7411 : 7
 best correlation 0.343251 rad1 2 rad2 2 : 8
 best correlation 0.310382 rad1 2 rad2 1.86607 : 9
 best correlation 0.291027 rad1 1.7411 rad2 1.7411 : 10
 best correlation 0.288447 rad1 2 rad2 1.86607 : 11
 best correlation 0.264742 rad1 2 rad2 2.14355 : 12
 best correlation 0.260942 rad1 1.41421 rad2 1.41421 : 13
 best correlation 0.240546 rad1 1.86607 rad2 1.7411 : 14
 best correlation 0.223823 rad1 2 rad2 1.86607 : 15
 best correlation 0.212918 rad1 2 rad2 2.14355 : 16
 best correlation 0.205404 rad1 1.51572 rad2 1.41421 : 17
 best correlation 0.193035 rad1 1.7411 rad2 1.6245 : 18
 best correlation 0.189772 rad1 1.86607 rad2 1.6245 : 19
 best correlation 0.183996 rad1 1.86607 rad2 1.7411 : 20
 Matched 21 blobs 
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
/opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr<T>::solve() : matrix is rank-deficient by 4
HDF5-DIAG: Error detected in HDF5 (1.8.7) thread 0:
  #000: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5F.c line 794 in H5Fis_hdf5(): unable to open file
    major: Low-level I/O
    minor: Unable to initialize object
  #001: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FD.c line 1086 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #002: /opt/miscelaneous/binary_ants/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDsec2.c line 348 in H5FD_sec2_open(): unable to open file: name = 'zMatchedAffine.txt', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
    major: File accessability
    minor: Unable to open file
 Rather than opening 1 as an image file, this program has decided, in its great wisdom, to consider it to be a floating point numerical value, and has acted accordingly -- i.e. read this as a number. 
rm: cannot remove 'z*ffine.txt': No such file or directory
sora@sora:~/ants/bin/featureMatching$ 
sucv commented 7 years ago

Finally, for antsRegistrationCommand.sh, I changed the input only

fixedPoints='data/fix1.nii.gz'
movingPoints='data/mov1.nii.gz'

outputDirectory='./'
outputPrefix=${outputDirectory}/pseChicken4xChicken3
s=0.1 # sampling rate
k=10 # k - neighborhood
antsRegistration -d 2 \
                 -o ${outputPrefix} \
                 -r [${fixedPoints},${movingPoints},1] \
                 -m PSE[${fixedPoints},${movingPoints},1,${s},1,20,$k] \
                 -t Affine[0.1] \
                 -c [50,0,10] \
                 -s 0 \
                 -f 1 \
                 -m PSE[${fixedPoints},${movingPoints},1,${s},1,10,$k] \
                 -t Affine[0.1] \
                 -c [40,0,10] \
                 -s 0 \
                 -f 1 \
                 -m PSE[${fixedPoints},${movingPoints},1,${s},1,5,$k] \
                 -t Affine[0.1] \
                 -c [20,0,10] \
                 -s 0 \
                 -f 1 \
                 -x [${fixedPoints}]

 antsApplyTransforms -d 2 \
                     -o ${outputPrefix}Warped.nii.gz \
                     -i ${movingPoints} \
                     -r ${fixedPoints} \
                     -n NearestNeighbor \
                     -t ${outputPrefix}0GenericAffine.mat

and obtained

sora@sora:~/ants/bin/chicken$ ./antsRegistrationCommand.sh 
All_Command_lines_OK
Using double precision for computations.
=============================================================================
The composite transform comprises the following transforms (in order): 
  1. Center of mass alignment using fixed image: data/fix1.nii.gz and moving image: data/mov1.nii.gz (type = Euler2DTransform)
=============================================================================
  number of levels = 1
  number of levels = 1
  number of levels = 1
  fixed point set: data/fix1.nii.gz
  moving point set: data/mov1.nii.gz
  fixed point set: data/fix1.nii.gz
  moving point set: data/mov1.nii.gz
  fixed point set: data/fix1.nii.gz
  moving point set: data/mov1.nii.gz
Dimension = 2
Number of stages = 3
Use Histogram Matching false
Winsorize image intensities false
Lower quantile = 0
Upper quantile = 1
Stage 1 State
   Point Set Metric = PSE
     Fixed point set = PointSet (0x47d5e50)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 56456
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 24674
  RealTimeStamp: 0 seconds 
  Number Of Points: 542
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x47d56e0
  Size of Point Data Container: 542

     Moving point set = PointSet (0x47da2d0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 56457
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 56454
  RealTimeStamp: 0 seconds 
  Number Of Points: 725
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x47c7de0
  Size of Point Data Container: 725

     Weighting = 1
     Use only boundary points = true
     Point set sigma = 20
     Evaluation K neighborhood = 10
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 0.1
   Transform = Affine
     Gradient step = 0.1
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Stage 2 State
   Point Set Metric = PSE
     Fixed point set = PointSet (0x47db6b0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 111202
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 79408
  RealTimeStamp: 0 seconds 
  Number Of Points: 517
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x47dcba0
  Size of Point Data Container: 517

     Moving point set = PointSet (0x47d68e0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 111203
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 111200
  RealTimeStamp: 0 seconds 
  Number Of Points: 728
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x47daca0
  Size of Point Data Container: 728

     Weighting = 1
     Use only boundary points = true
     Point set sigma = 10
     Evaluation K neighborhood = 10
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 0.1
   Transform = Affine
     Gradient step = 0.1
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Stage 3 State
   Point Set Metric = PSE
     Fixed point set = PointSet (0x47d57a0)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 165752
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 134010
  RealTimeStamp: 0 seconds 
  Number Of Points: 481
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x4835510
  Size of Point Data Container: 481

     Moving point set = PointSet (0x47d8750)
  RTTI typeinfo:   itk::PointSet<unsigned int, 2u, itk::DefaultStaticMeshTraits<unsigned int, 2u, 2u, float, float, unsigned int> >
  Reference Count: 2
  Modified Time: 165753
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 165750
  RealTimeStamp: 0 seconds 
  Number Of Points: 715
  Requested Number Of Regions: 0
  Requested Region: -1
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 0x4839340
  Size of Point Data Container: 715

     Weighting = 1
     Use only boundary points = true
     Point set sigma = 5
     Evaluation K neighborhood = 10
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 0.1
   Transform = Affine
     Gradient step = 0.1
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Registration using 3 total stages.

Stage 0
  iterations = 50
  convergence threshold = 0
  convergence window size = 10
  number of levels = 1
  Shrink factors (level 1 out of 1): [1, 1]
  smoothing sigmas per level: [0]
  Using default NONE metricSamplingStrategy 

*** Running affine registration ***

WARNING: In /opt/miscelaneous/binary_ants/ITKv4-install/include/ITK-4.7/itkLabeledPointSetToPointSetMetricv4.hxx, line 227
LabeledPointSetToPointSetMetricv4 (0x483bbd0): The label sets are not bijective.

Exception caught: 
itk::ExceptionObject (0x4ab6ce0)
Location: "unknown" 
File: /opt/miscelaneous/binary_ants/ITKv4-install/include/ITK-4.7/itkLabeledPointSetToPointSetMetricv4.hxx
Line: 114
Description: itk::ERROR: LabeledPointSetToPointSetMetricv4(0x483bbd0): Label not found in common label set

Using double precision for computations.
Input scalar image: data/mov1.nii.gz
Reference image: data/fix1.nii.gz
=============================================================================
The composite transform comprises the following transforms (in order): 
  1. .//pseChicken4xChicken30GenericAffine.mat (type = AffineTransform)
=============================================================================
Default pixel value: 0
Interpolation type: NearestNeighborInterpolateImageFunction
Output warped image: .//pseChicken4xChicken3Warped.nii.gz
sora@sora:~/ants/bin/chicken$ 
ntustison commented 7 years ago

Since you're able to run antsRegistrationCommand.sh, please just start from there to apply to your own data. In other words ignore cars.sh and featureMatching.sh.

sucv commented 7 years ago

The results about running antsRegistrationCommand.sh using my own data was posted just now. Please check.

ntustison commented 7 years ago

The error is pretty clear. When you have two point sets represented by a pair of images, the voxel values represent the label. Apparently in your images, the two point sets do not have any labels in common so there's nothing to register.

sucv commented 7 years ago

Forgive me, I am not familiar with ANTs. For my owned research, what I need to do is
(i) input image pair, and the feature extractor (e.g., SIFT) will find the feature point (maybe this is what label means in your comment), (ii) register those feature points; (iii) generate the transformed image using the backward approach.

So here for the ANTs, how can I determine the labels? I have once been carefully checked every entry of the nifti image as a mat file using matlab. I can not figure out any obvious difference between my data and chicken data.

sucv commented 7 years ago

wait, I found the difference ! for chicken, the entry of matrix are 0 and 1, while in my data, they are 0 and 255. Let me try again.

ntustison commented 7 years ago

Try changing the background/foreground to 0/1 instead of 0/255. You can do this by

ThresholdImage 2 $fixed $fixed 0 0 0 1
sucv commented 7 years ago

Now I successfully obtained the rigid transformed image using antsRegistrationCommand.sh. So I drill down further to antsRegistrationCommandDiffeomorphismTest.sh, hopefully obtained non-rigid output. However, both the original version and amended version of this script occur errors. It failed to generate the warp nifti images. The logs for amended original and amended version are shown respectively here.

Original version:

Sora@Su MINGW64 /d/Ants-2.1.0/Release
$ antsRegistrationCommandDiffeomorphismTest.sh
All_Command_lines_OK
Using double precision for computations.
  number of levels = 5
  fixed point set: data/pointsLowerLeftP.nii.gz
  moving point set: data/pointsUpperRightP.nii.gz
Dimension = 2
Number of stages = 1
Use Histogram Matching false
Winsorize image intensities false
Lower quantile = 0
Upper quantile = 1
Stage 1 State
   Point Set Metric = PSE
     Fixed point set = PointSet (000002260D152F70)
  RTTI typeinfo:   class itk::PointSet<unsigned int,2,class itk::DefaultStaticMeshTraits<unsigned int,2,2,float,float,unsigned int> >
  Reference Count: 2
  Modified Time: 1917
  Debug: Off
  Object Name:
  Observers:
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 1466
  RealTimeStamp: 0 seconds
  Number Of Points: 63
  Requested Number Of Regions: 1
  Requested Region: 0
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 000002260D1C5C20
  Size of Point Data Container: 63

     Moving point set = PointSet (000002260D1C13D0)
  RTTI typeinfo:   class itk::PointSet<unsigned int,2,class itk::DefaultStaticMeshTraits<unsigned int,2,2,float,float,unsigned int> >
  Reference Count: 2
  Modified Time: 1918
  Debug: Off
  Object Name:
  Observers:
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 1915
  RealTimeStamp: 0 seconds
  Number Of Points: 63
  Requested Number Of Regions: 1
  Requested Region: 0
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 000002260D1C6400
  Size of Point Data Container: 63

     Weighting = 1
     Use only boundary points = false
     Point set sigma = 50
     Evaluation K neighborhood = 5
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 1
   Transform = BSplineSyN
     Gradient step = 0.2
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Registration using 1 total stages.

Stage 0
  iterations = 200x200x200x200x50
  convergence threshold = 0
  convergence window size = 10
  number of levels = 5
  Shrink factors (level 1 out of 5): [8, 8]
  Shrink factors (level 2 out of 5): [8, 8]
  Shrink factors (level 3 out of 5): [4, 4]
  Shrink factors (level 4 out of 5): [2, 2]
  Shrink factors (level 5 out of 5): [1, 1]
  smoothing sigmas per level: [0, 0, 0, 0, 0]
  Using default NONE metricSamplingStrategy
/d/Ants-2.1.0/Release/antsRegistrationCommandDiffeomorphismTest.sh: line 23: 15076 Segmentation fault      antsRegistration -d 2 -o ${outputPrefix} -x [${fixedPoints},${movingPoints}] -m PSE[${fixedPoints},${movingPoints},1,${s},0,50,$k] -t $tx -c [200x200x200x200x50,0,10] -s 0x0x0x0x0 -f 8x8x4x2x1

real    0m0.067s
user    0m0.000s
sys     0m0.000s
Using double precision for computations.
Input scalar image: data/pointsUpperRightP.nii.gz
Reference image: data/pointsLowerLeftP.nii.gz
Transform file does not exist: .//diffeomorphismTest0Warp.nii.gz
Can't read initial transform .//diffeomorphismTest0Warp.nii.gz
Using double precision for computations.
Input scalar image: data/pointsLowerLeftP.nii.gz
Reference image: data/pointsUpperRightP.nii.gz
Transform file does not exist: .//diffeomorphismTest0InverseWarp.nii.gz
Can't read initial transform .//diffeomorphismTest0InverseWarp.nii.gz
 Compute  phi(  phi^{-1}(x))

Sora@Su MINGW64 /d/Ants-2.1.0/Release
$

Amended version:

Sora@Su MINGW64 /d/Ants-2.1.0/Release
$ antsRegistrationCommandDiffeomorphismTest.sh
All_Command_lines_OK
Using double precision for computations.
  number of levels = 5
  fixed point set: fix1P.nii.gz
  moving point set: mov1P.nii.gz
Dimension = 2
Number of stages = 1
Use Histogram Matching false
Winsorize image intensities false
Lower quantile = 0
Upper quantile = 1
Stage 1 State
   Point Set Metric = PSE
     Fixed point set = PointSet (000002AFADF5F800)
  RTTI typeinfo:   class itk::PointSet<unsigned int,2,class itk::DefaultStaticMeshTraits<unsigned int,2,2,float,float,unsigned int> >
  Reference Count: 2
  Modified Time: 615161
  Debug: Off
  Object Name:
  Observers:
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 310866
  RealTimeStamp: 0 seconds
  Number Of Points: 77413
  Requested Number Of Regions: 1
  Requested Region: 0
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 000002AFADEE72F0
  Size of Point Data Container: 77413

     Moving point set = PointSet (000002AFADEF5540)
  RTTI typeinfo:   class itk::PointSet<unsigned int,2,class itk::DefaultStaticMeshTraits<unsigned int,2,2,float,float,unsigned int> >
  Reference Count: 2
  Modified Time: 615162
  Debug: Off
  Object Name:
  Observers:
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 615159
  RealTimeStamp: 0 seconds
  Number Of Points: 76024
  Requested Number Of Regions: 1
  Requested Region: 0
  Buffered Region: -1
  Maximum Number Of Regions: 1
  Point Data Container pointer: 000002AFADEE8730
  Size of Point Data Container: 76024

     Weighting = 1
     Use only boundary points = false
     Point set sigma = 50
     Evaluation K neighborhood = 5
     Alpha = 1.1
     Use anisotropic covariances = false
     Sampling percentage = 1
   Transform = BSplineSyN
     Gradient step = 0.2
     Update field sigma (voxel space) = 0
     Total field sigma (voxel space) = 0
     Update field time sigma = 0
     Total field time sigma  = 0
     Number of time indices = 0
     Number of time point samples = 0
Registration using 1 total stages.

Stage 0
  iterations = 200x200x200x200x50
  convergence threshold = 0
  convergence window size = 10
  number of levels = 5
  Shrink factors (level 1 out of 5): [8, 8]
  Shrink factors (level 2 out of 5): [8, 8]
  Shrink factors (level 3 out of 5): [4, 4]
  Shrink factors (level 4 out of 5): [2, 2]
  Shrink factors (level 5 out of 5): [1, 1]
  smoothing sigmas per level: [0, 0, 0, 0, 0]
  Using default NONE metricSamplingStrategy
/d/Ants-2.1.0/Release/antsRegistrationCommandDiffeomorphismTest.sh: line 23:  4596 Segmentation fault      antsRegistration -d 2 -o ${outputPrefix} -x [${fixedPoints},${movingPoints}] -m PSE[${fixedPoints},${movingPoints},1,${s},0,50,$k] -t $tx -c [200x200x200x200x50,0,10] -s 0x0x0x0x0 -f 8x8x4x2x1

real    0m0.178s
user    0m0.015s
sys     0m0.000s
Using double precision for computations.
Input scalar image: mov1P.nii.gz
Reference image: fix1P.nii.gz
Transform file does not exist: .//diffeomorphismTest0Warp.nii.gz
Can't read initial transform .//diffeomorphismTest0Warp.nii.gz
Using double precision for computations.
Input scalar image: fix1P.nii.gz
Reference image: mov1P.nii.gz
Transform file does not exist: .//diffeomorphismTest0InverseWarp.nii.gz
Can't read initial transform .//diffeomorphismTest0InverseWarp.nii.gz
 Compute  phi(  phi^{-1}(x))

Sora@Su MINGW64 /d/Ants-2.1.0/Release
$
ntustison commented 7 years ago

Instead of that one, please look at this example which also uses a deformable stage.

By the way, when you write:

(i) input image pair, and the feature extractor (e.g., SIFT) will find the feature point (maybe this is what label means in your comment), (ii) register those feature points; (iii) generate the transformed image using the backward approach.

it should be pointed out that the JHCT/PSE metric work does not include step (i).

sucv commented 7 years ago

OK, now everything works fine. Here's my conclusion.

(i) Building latest ANTs (It has no difference that the ITK4 is installed previously or git clone while building ANTs) on Windows10 via Visual Studio is a bad idea (hundreds of errors will occur). Instead, one should do it on Linux, which makes life rather easy.

(ii) Running the pre-build executable ANTs on Windows 10 via Git Bash is also a bad idea. Many intermediate files (e.g., some of the nifti images which should be generated during the computation and removed in the end automatically) cannot be generated normally. While it meets no problems on Linux. Maybe it is due to the permission issues of Windows Bash which I haven't been drilled down.

(iii) While building ANTs on Linux (mine is Ubuntu 16.04), two files are missing.

itkLabelGeometryImageFilter.h
itkLabelGeometryImageFilter.hxx

What I do is copying them from ITK4 bins and then paste to ANTs and no problem occurs anymore.

That's all. Sincerely thank ntustison, stnava and cookpa. I also would like to show my respect to the developers on their great work who spare years on the development and maintenance of ANTs. :)

ntustison commented 7 years ago

Great. Glad you got it to work.