[Insight-users] MultiResolutionPyramidImageFilter: different behavior 32 bit vs 64 bit

Maarten Beek beekmaarten at yahoo.com
Fri May 28 15:02:42 EDT 2010


Hi Luis,

We are using ITK within Amira, so I'll do my best to 
only send the code I think is required to duplicate this issue:
The 
DICOM images are quite big so I didn't attached them (yet), but I can 
give the following info:
fixed: size: 206x212x210, voxelsize: 
0.0349x0.0349x0.0349001
moving: size: 243x229x242, voxelsize: 
0.0349x0.0349x0.0349001
The warnings only appear on 64 bit system for pyramid levels of 6 and greater.
Since the smoothing of the deform 
field and update field are turned off in the pde filter, I think the 
warnings only originate from the image pyramids. The warnings include 
both truncations to 33 (DiscreteGaussianImageFilter) and to 31 
(GaussianOperator).

Main while I have created a class which inherits from MultiResolutionPyramidImageFilter, but for which I overloaded the functions GenerateInputRequestedRegion() and GenerateData() to remove all smoothing. This removes the 33 
truncation warnings but still leaves me with 6 31 truncution warnings.

    const unsigned int Dimension = 3;
    typedef float ImagePixelType;
    typedef itk::Image<ImagePixelType, Dimension> ImageType;
    
typedef itk::Vector<float, Dimension> VectorPixelType;
    
typedef itk::Image<VectorPixelType, Dimension> DeformType;

    // Via the Amira interface we can choose various PDE filters
    
typedef itk::PDEDeformableRegistrationFilter<ImageType, ImageType, 
DeformType> ItkPDEType;
    ItkPDEType::Pointer AlgoPtr = NULL;
    switch ( portAlgorithm.getIndex() )
    {
    case 
0:    // Demons
        typedef 
itk::DemonsRegistrationFilter<ImageType, ImageType, DeformType> 
DemonsType;
        AlgoPtr = DemonsType::New();

        
static_cast<DemonsType*>(AlgoPtr.GetPointer())->
            SetIntensityDifferenceThreshold( 0.001 );
        break;
    case 1:
        <other PDE filters>

    default:
        
<...>
        break;
    }

    // set some additional options
    AlgoPtr->UseImageSpacingOff();                                    
        // default: off
    // used to smooth the deformation and 
update field if requested
    AlgoPtr->SetMaximumError( 0.1 );
    AlgoPtr->SetMaximumKernelWidth( 45 );
    
AlgoPtr->SetMaximumRMSError( 0.001 );
    
AlgoPtr->SetSmoothDeformationField( 0 );        // default: on
    AlgoPtr->SetSmoothUpdateField( 0 );            // default: off

    int levels = portLevels.getValue();    // here we set the no. of levels in Amira
    if ( levels < 1 ) { levels = 1; }
    unsigned int* iterations = new unsigned int[levels];
    
for ( int i = 0; i < levels; i++ )
    {
        iterations[i] = 10;
    }

    // set up the multi res registration filter
    typedef itk::MultiResolutionPDEDeformableRegistration<ImageType, 
ImageType, DeformType> ItkMultiResPDEType;
    
ItkMultiResPDEType::Pointer multiresfilter = ItkMultiResPDEType::New();
    multiresfilter->SetRegistrationFilter( AlgoPtr );
    
multiresfilter->SetFixedImage( pItkRefImage );
    
multiresfilter->SetMovingImage( pItkMovingImage );
    
multiresfilter->SetNumberOfLevels( levels );
    
multiresfilter->SetNumberOfIterations( iterations );
    multiresfilter->SetNumberOfThreads( 4 );

    try 
    {
        multiresfilter->Update();
    }
    catch( 
itk::ExceptionObject& err )
    {
    }

I hope this 
additional info will help.

Thanks - 
Maarten




________________________________
From: Luis Ibanez <luis.ibanez at kitware.com>
To: Maarten Beek <beekmaarten at yahoo.com>
Cc: insight-users at itk.org
Sent: Wed, May 26, 2010 1:48:43 PM
Subject: Re: [Insight-users] MultiResolutionPyramidImageFilter: different  behavior 32 bit vs 64 bit


Hi Maarten,

The computation precision should be the same
in a 64 bits machine (for float/double numbers).

However, the fact that you only get the warning
in 64bits build certainly shows that the platform
matters.

Could you please post to the list a minimal 
snippet of code that illustrates this problem ?

(including all the numerical parameters that
you are using).


It will be very helpful if we manage to replicate
the warning message.


     Thanks

 
           Luis



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

On Tue, May 25, 2010 at 1:05 PM, Maarten Beek <beekmaarten at yahoo.com> wrote:

Hi all,
>
>The MultiResolutionPDEDeformableRegistration filter (with any of the PDEDeformableRegistrationFilter filters) uses the MultiResolutionPyramidImageFilter class to create image pyramids for the fixed and moving image. This MultiResolutionPyramidImageFilter class gives a warning about a kernel being truncated because it is growing too big when run on 64 bit system, while the warning doesn't appear when run on a 32 bit system (of course with the same values for the various parameters, like max error, variance).
>
>Is this caused by the machine precision? How can I prevent this warning on a 64 bit machine?
>
>Thanks - Maarten
>
>
>_____________________________________
>>Powered by www.kitware.com
>
>>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>>Kitware offers ITK Training Courses, for more information visit:
>http://www.kitware.com/products/protraining.html
>
>>Please keep messages on-topic and check the ITK FAQ at:
>http://www.itk.org/Wiki/ITK_FAQ
>
>>Follow this link to subscribe/unsubscribe:
>http://www.itk.org/mailman/listinfo/insight-users
>
>



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100528/e4c8a209/attachment.htm>


More information about the Insight-users mailing list