[Insight-users] Error using MultiResMIRegistration

Luis Ibanez luis.ibanez@kitware.com
Sat, 08 Mar 2003 21:58:48 -0500


Hi Vicente,

Thanks for trying these options.

The results of your experiment seem to indicate
that the Abort call is not the result of an
uncaught exception.

I'm affraid that the only way to trace the real
source of the error is to run the program in
a debugger...

1) What platform are you working on ?
    what compiler ?
    what version of ITK ?
    what version of CMake ?

2) Have you tried different types of images ?
    I wonder if the problem may be originated
    in the pixel data...

3) Could you put the images that are failing,
    in a site where I can get them ?

4) Or even better, could you first try with the
    BrainWeb images in the ftp site ?

    ftp://public.kitware.com/pub/itk/Data/BrainWeb/

    In this way we could discard the data as the
    source of error.


Please let us know what you find,

Thanks


Luis


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

Vicente Grau wrote:
> Hi Luis,
> 
> thank you very much for your answer. I've tried your suggestions, but 
> I've not been able to correct the problem:
> 
> - With a single level, as few as 100 iterations (or even 1 iteration), 
> and a very small learning rate (1e-08), the error is exactly the same.
> - I've modified the program as you've told me (see below). However, 
> still no catch is produced: the output is exactly the same as before. Is 
> it possible that the catch is not working for any reason?
> 
> Thanks again
> 
> Vicente
> 
> #include <fstream>
> 
> #include "SimpleApp.h"
> #include "itkExceptionObject.h"
> 
> 
> int main(int argc, char *argv[])
> {
>   try{
>       std::cout<< "Modified procedure" << std::endl;
>       if ( argc < 2 )
>         {
>         std::cout << "Parameter file name missing" << std::endl;
>         std::cout << std::endl;
>         std::cout << "Usage: MultiResMIRegistration param.file" << 
> std::endl;
>         return 1;
>         }
> 
>       // run the registration
>       try
>         {
>         typedef itk::SimpleApp<signed short> AppType;
>         AppType::Pointer theApp = AppType::New();
>         theApp->SetParameterFileName( argv[1] );
>         theApp->Execute();
>         }
>       catch( itk::ExceptionObject& err)
>         {
>         std::cout << "Caught an ITK exception: " << std::endl;
>         std::cout << err << std::endl;
>         }
>       catch(...)
>         {
>         std::cout << "Caught an non-ITK exception " << std::endl;
>         }
>       }
>   //Added to detect error
>   catch(std::exception & excep )
>       {
>       std::cerr << "Exception thrown = ";
>       std::cerr << excep.what() << std::endl;
>       }
>   //
> return 0;
> }
> 
> 
> 
> Luis Ibanez wrote:
> 
>>
>> Hi Vicente,
>>
>> When a program aborts it is usually an indication
>> that an exception has been thrown and nobody
>> is catching it.
>>
>> In this particular application there are multiple
>> catch statements, so this seems to be an unusual
>> error that is not anticipated by any of the
>> existing catch's.
>>
>>
>> Usual suspects are:
>>
>> 1) One of the common exceptions being thrown in
>>    registration is due to the fixed image and
>>    moving image not being overlapped at all.
>>    This ocurrs commonly when relatively large
>>    learning rates are provided to the optimizer.
>>
>>    ... but... when this common exception is thrown,
>>    there is a catch statment that receives it and
>>    print an specific message in the console.
>>
>>    You don't seems to be receiving this specific
>>    message....
>>
>>
>> 2) Another common source of exception being
>>    thrown is the initialization of the registration
>>    method. In this stage, all the components of
>>    the registration process are plugged together.
>>    (optimizer, metric, interpolator,...)
>>    If any of them is missing, an exeption is thrown.
>>
>>    ... have you modified this code in any way ?
>>    or are you running exactly as it exists in
>>    the repository ?
>>
>>
>> ----
>>
>> Suggestions:
>>
>> 1)  Go to the main() method of the application and
>>     put its body inside a try/catch statement like
>>
>>     main()
>>     {
>>      try {
>>        ... all the code except 'return 0;'
>>      }
>>      catch( std::exception & excep )
>>      {
>>       std::cerr << "Exception thrown = ";
>>       std::cerr << excep.what() << std::endl;
>>      }
>>
>>
>>    This message could hopefully give us an idea
>>    of what is going wrong in the process.
>>
>>
>> 2) Start with a single level (instead of 5), and
>>    use a smaller learning rate (e.g. 1e-8) for
>>    fewer iterations (e.g. 100).
>>
>> If this doesn't abort, we will know that the initialization
>> is ok, and the problem should be appearing during
>> the optimization process. In that case you can add more
>> iterations. If you can get to 2500 iterations, then it is
>> time to attempt a second level in the pyramid, and so on.
>>
>>
>>
>> -----
>>
>> Please try this, and let us know what you find.
>>
>>
>> Thanks
>>
>>
>>    Luis
>>
>>
>>
>> ---------------------
>>
>> Vicente Grau wrote:
>>
>>> Hello,
>>>
>>> I'm trying to use the MultiResMIRegistration program on two 3D 
>>> volumes that I've created. The parameters file that I'm using now is:
>>> ------------------------
>>> Img_1.raw
>>> 1
>>> 100 100 20
>>> 0.293 0.293 1.6
>>> Img_2.raw
>>> 1
>>> 100 100 20
>>> 0.293 0.293 1.6
>>> 0 1 2
>>> 0 0 0
>>> 5
>>> 4 4 1
>>> 4 4 1
>>> 2500 2500 2500 2500 2500
>>> 1e-4 1e-5 5e-6 1e-6 5e-7
>>> 320
>>> Registered_1
>>> ---------------------------
>>>
>>> I've tried also other combinations of parameters, but the result is 
>>> always the one shown below:  the program always aborts immediately 
>>> after starting with the first level. The directory Registered_1 
>>> exists, I've created it previously. Do you know what's happening in 
>>> this case?
>>>
>>> ---------------------------------
>>> Parsing input ...
>>> Fixed image filename: Img_1.raw
>>> Big Endian: 1
>>> Image Size: [100, 100, 20]
>>> Image Spacing: [0.293, 0.293, 1.6]
>>> Moving image filename: Img_2.raw
>>> Big Endian: 1
>>> Image Size: [100, 100, 20]
>>> Image Spacing: [0.293, 0.293, 1.6]
>>> Permute order: [0, 1, 2]
>>> Flip axes: [0, 0, 0]
>>> Number of levels: 5
>>> Fixed image shrink factors: [4, 4, 1]
>>> Moving image shrink factors: [4, 4, 1]
>>> Number of iterations: [2500, 2500, 2500, 2500, 2500]
>>> Learning rates: [0.0001, 1e-05, 5e-06, 1e-06, 5e-07]
>>> Translation scale: 320
>>> PGM directory: Registered_1
>>>
>>> Preprocess the images ...
>>> Register the images ...
>>> --- Starting level 0
>>> No. Iterations: 2500 Learning rate: 0.1
>>> Abort
>>>
>>> ------------------------------
>>>
>>> Thanks
>>>
>>> Vicente Grau-Colomer
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users@public.kitware.com
>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>
>>
>>
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-users
> 
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>