Skip to content

Bug in ExtractROI (radius and extent modes)

Cédric Traizet requested to merge bug_extract_roi into develop

Summary

ExtractROI copy the full input image in the output image when using the extent and radius modes (issue #1927 (closed)).

Rationale

In the DoUpdateParameters() method of the ExtractROI application, if we are in radius or extent mode, the input position parameter (upper left/lower right for the extent mode, center and radius for radius mode) are converted to origin and size, and the startx, starty, sizex, sizey parameters are then set accordingly. The ExtractROI filter should then be used using these parameters.

But during the DoExecute() method, in the CropRegionOfInterest method, the startx, starty, sizex and sizey parameters are then overridden by the following code:

    if ( !HasUserValue("sizex") )
      SetParameterInt( "sizex" , 
        GetDefaultParameterInt( "sizex" ) );
    if ( !HasUserValue("sizey") )
      SetParameterInt( "sizey" , 
        GetDefaultParameterInt( "sizey" ) );
    if ( !HasUserValue("startx") )
      SetParameterInt( "startx" , 
        GetDefaultParameterInt( "startx" ) );
    if ( !HasUserValue("starty") )
      SetParameterInt( "starty" , 
        GetDefaultParameterInt( "starty" ) );

The default values for these parameters are the full image extent (also computed in DoUpdateParameters() method.

The problem is that HasUserValue("param") is false if the parameter has been set in DoInit, DoUpdateParameter or DoExecute. This MR changes these methods to "HasValue("param")"

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit

Merge request reports