[Insight-users] Text output problems in MultiResMIRegistration
Vicente Grau
vicente at robots.ox.ac.uk
Fri Nov 19 10:47:34 EST 2004
Ok, I think I just made it work. I suspect the problem had something to
do with pthreads in cygwin, but I am not totally sure. Anyway, I
installed a new version of the package called 'cygwin: The UNIX
emulation engine', I reinstalled everything and it's working now. In
case somebody else finds this problem, my version now is cygwin
1.5.12-1. I had 1.5.11-1 before.
Thanks very much for your help.
Vicente
Vicente Grau wrote:
> Thank you again, Luis. After "Preprocess the images...", the program
> does not crash. It goes on and finally produces a valid result, which
> as far as I can see is a correct registration. The times you have told
> me are also consistent with what I have seen in my computer. I would
> say that the only problem is the text output.
> I have plenty of memory and it doesn't seem to be a problem either.
>
> Regarding the build process, I don't think I am using optimization (I
> don't remember checking that option, at least...). These are the
> commands I am using. Do you think optimization might be a problem?
> Should I reinstall everything, ensuring that no optimizations are
> carried out?
>
>
> g++ -o Common/MultiResMIRegistration.o -ftemplate-depth-50
> -DNOMINMAX -g -I/cygdrive/e/ITK/InsightToolkit-binary
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/Algorithms
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/BasicFilters
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/Common
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/Numerics
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/IO
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/Numerics/FEM
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/Numerics/Statistics
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Code/SpatialObject
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities/MetaIO
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities/NrrdIO
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities/DICOMParser
> -I/cygdrive/e/ITK/InsightToolkit-binary/Utilities/DICOMParser
> -I/cygdrive/e/ITK/InsightToolkit-binary/Utilities/expat
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities/expat
> -I/cygdrive/e/ITK/InsightToolkit-binary/Utilities
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities/vxl/vcl
> -I/cygdrive/e/ITK/InsightToolkit-1.8.0/Utilities/vxl/core
> -I/cygdrive/e/ITK/InsightToolkit-binary/Utilities/vxl/vcl
> -I/cygdrive/e/ITK/InsightToolkit-binary/Utilities/vxl/core
> -I/usr/include/w32api
> -I/cygdrive/e/ITK/InsightApplications-1.8.0/MultiResMIRegistration/Common
> -I/cygdrive/e/ITK/InsightApplications-1.8.0/MultiResMIRegistration/../IBSRValidation/Common
> -c
> /cygdrive/e/ITK/InsightApplications-1.8.0/MultiResMIRegistration/Common/MultiResMIRegistration.cxx
>
>
>
> g++ -ftemplate-depth-50 -DNOMINMAX
> Common/MultiResMIRegistration.o -o
> /cygdrive/e/ITK/InsightApplications-binary/MultiResMIRegistration/MultiResMIRegistration.exe
> -L/cygdrive/e/ITK/InsightToolkit-binary/bin
> -L/cygdrive/e/ITK/gdcm-0.4.0/gdcm -lITKAlgorithms -lITKCommon
> -lITKBasicFilters -lITKNumerics -lITKIO -lITKBasicFilters -lITKNrrdIO
> -litkpng -litktiff -litkjpeg -lITKMetaIO -litkzlib -lITKDICOMParser
> -lITKEXPAT -lITKCommon -litkvnl_inst -litkvnl_algo -litkvnl -litkvcl
> -litknetlib -lm -litksys -lpthread -lgdi32 -lm
>
>
> Luis Ibanez wrote:
>
>>
>> Hi Vincent,
>>
>>
>> What happens after you get the message:
>>
>> > Preprocess the images ...
>>
>> ???
>>
>> Does it crashes ?
>> Does it keeps running ?
>> Does it exists ?
>>
>> Did you forced the program to stop ?
>>
>>
>> It may simply be that it is still computing
>> the first level of the pyramid....
>>
>>
>> Did you checked with your Task Manager to see
>> if the programs is still running and taking
>> CPU cycles ?
>>
>> The normal output from this filter is the following:
>> (fresh from a Linux run with today's CVS version)
>>
>> ========================================================
>> Parsing input ...
>> Fixed image filename: brainweb165a10f17.mha
>> Moving image filename: brainweb1e5a10f17Rot10Tx15.mha
>> 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: [8, 8, 1]
>> Number of iterations: [2500, 2500, 2500, 2500, 2500]
>> Learning rates: [1e-04, 1e-05, 5e-06, 1e-06, 5e-07]
>> Translation scale: 320
>> Output filename: t1tot2.mhd
>>
>> Preprocess the images ...
>> Register the images ...
>> --- Starting level 0
>> No. Iterations: 2500 Learning rate: 1e-04
>> --- Starting level 1
>> No. Iterations: 2500 Learning rate: 1e-05
>> --- Starting level 2
>> No. Iterations: 2500 Learning rate: 5e-06
>> --- Starting level 3
>> No. Iterations: 2500 Learning rate: 1e-06
>> --- Starting level 4
>> No. Iterations: 2500 Learning rate: 5e-07
>> Final parameters: [-1.7988e-05, 0.000144513, -0.0873063, 0.996182,
>> 2.38895, -17.2621, 0.103705]
>> Overall transform matrix:
>> 0.984755 0.173946 0.000291063
>> -0.173946 0.984755 1.06049e-05
>> -0.000284781 -6.10723e-05 1
>>
>> Overall transform offset:
>> [-15.0512, 0.0384943, 0.135935]
>> Generating output ...
>>
>> =========================================
>>
>> The whole process took 109 seconds
>> in a dual processor Pentium IV, 2.4Ghz
>> running Debian Linux and Gcc 3.3
>>
>> ==========================================
>>
>> The time between the message:
>>
>> Preprocess the images ...
>>
>> and the message
>>
>> Register the images ...
>>
>>
>> was about 3 seconds.
>>
>> ===============================
>>
>> Note that this example is memory demanding, it may
>> reache a memory footprint of 750 Mbytes.
>>
>> You may want to double check with your Task Manager
>> to see if your system is swapping memory to disk.
>> If this is the case, that will explain a long
>> computation time...
>>
>> ===================================
>>
>> BTW, did you compiled this program with optmization ?
>>
>>
>>
>> Please let us know what you find,
>>
>>
>> Thanks
>>
>>
>>
>> Luis
>>
>>
>>
>> -------------------
>> Vicente Grau wrote:
>>
>>> Luis,
>>>
>>> thank you very much for your help. I am sorry I didn't explain my
>>> problem well enough. The fact is that I don't get any messages from
>>> the Command/Observer at all. The text output I get from the program is:
>>>
>>> MultiResMIRegistration.exe BrainWebT1toT2b.txt
>>> Parsing input ...
>>> Fixed image filename: brainweb165a10f17.mha
>>> brainweb1e5a10f17Rot10Tx15.mha
>>> 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: [8, 8, 1]
>>> Number of iterations: [2500, 2500, 2500, 2500, 2500]
>>> Learning rates: [0.0001, 1e-05, 5e-06, 1e-06, 5e-07]
>>> Translation scale: 320
>>> Output filename: t1tot2.mha
>>> Preprocess the images ...
>>>
>>> and that's all. There are other std::cout<< lines that should be
>>> executed (in MIMApplicationBase::Execute(), std::cout << "Register
>>> the images ... ") that don't seem to work (I have checked on gdb if
>>> the program went through them, and it did so but with no effect.) I
>>> also added other cout << lines myself, not related to the Command/
>>> Observer, but directly in the function MIMPreprocessor::Execute(),
>>> and I found that they stopped working right after the
>>> normalizer->Update(); line. That's why I thought this could be
>>> interfering with the std output. I don't know what else it could be;
>>> any ideas?
>>>
>>> Thank you very much.
>>>
>>> Vicente
>>>
>>>
>>> Luis Ibanez wrote:
>>>
>>>>
>>>> Hi Vicente,
>>>>
>>>>
>>>> Thanks for your detailed report.
>>>>
>>>> The MultiResMIRegistration application only have one
>>>> Observer connected to the registration algorithm.
>>>>
>>>> This observer is only intended to react to the changes
>>>> in resolution level. In other words, since this is a
>>>> multi-resolution registration, IterationEvents are triggered
>>>> *at the end* of the registration process of each level
>>>> of the pyramid.
>>>>
>>>> What the Command/Observer does at that point is to invoke
>>>> the StartNewLevel() method of the MIMRegistrator. In lines
>>>> 180-202. This method *only* prints out the number of iterations
>>>> and the learning rate that is going to be used for the *next*
>>>> level of the pyramid.
>>>>
>>>> In summary: In this application you should only expect *one*
>>>> printed line per change in level of the pyramid. Since you are
>>>> setting your registration to use 5 levels, you will only get
>>>> 4 messages.
>>>>
>>>> If you want to get trace output from the registration process
>>>> inside each one of the pyramid level, you may want to add
>>>> another Command/Observer and connect it to the optimizer.
>>>>
>>>> You will find multiple examples on how to do this in the
>>>> ITK Software Guide
>>>>
>>>> http://www.itk.org/ItkSoftwareGuide.pdf
>>>>
>>>>
>>>> in the registration chapter.
>>>>
>>>>
>>>>
>>>> Please let us konw if you have further questions,
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>>
>>>> Luis
>>>>
>>>>
>>>>
>>>> -----------------------
>>>> Vicente Grau wrote:
>>>>
>>>>> Hi everybody,
>>>>>
>>>>> I have recently installed ITK Release 1.8.1 on a Windows XP
>>>>> platform using cygwin. Running MultiResMIRegistration on two
>>>>> sample images (brainweb165a10f17.mha and
>>>>> brainweb1e5a10f17Rot10Tx15.mha, both in the ftp server), the
>>>>> program returns a reasonable registered image. However, I can see
>>>>> no text output from the Observer. Adding some cout<< lines to
>>>>> check where it fails, I have tracked the problem down to
>>>>> MIMPreprocessor.txx: in function Execute(), it stops printing
>>>>> anything right after the line:
>>>>> normalizer->Update();
>>>>>
>>>>> Is it possible that this command somehow interferes with text
>>>>> printing in my window?
>>>>> I have debugged the program with gdb and it runs correctly past
>>>>> this line, only it doesn't react to cout<< lines anymore.
>>>>> I have gone through the pdfs and the list, but I couldn't find
>>>>> anything related. Any help will be much appreciated!
>>>>>
>>>>> This is the parameters file I am using as input to the program.
>>>>>
>>>>> brainweb165a10f17.img
>>>>> brainweb1e5a10f17Rot10Tx15.img
>>>>> 0 1 2
>>>>> 0 0 0
>>>>> 5
>>>>> 4 4 1
>>>>> 8 8 1
>>>>> 2500 2500 2500 2500 2500
>>>>> 1e-4 1e-5 5e-6 1e-6 5e-7
>>>>> 320
>>>>> t1tot2.mha
>>>>>
>>>>>
>>>>> Vicente Grau
>>>>>
>>>>> _______________________________________________
>>>>> Insight-users mailing list
>>>>> Insight-users at itk.org
>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>>
>>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list