Skip to content

Commit 643ead7

Browse files
Simon RitSimonRit
authored andcommitted
BUG: Fix handling of deprecated application argument --dimension
1 parent 30f247b commit 643ead7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

applications/rtk3Doutputimage_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def SetConstantImageSourceFromArgParse(source, args_info):
4646
ImageType = type(source.GetOutput())
4747

4848
# Handle deprecated --dimension argument
49-
if args_info.dimension is not None:
49+
if args_info.dimension is not None and args_info.Size is None:
5050
print(
5151
"Warning: '--dimension' is deprecated and will be removed in a future release. "
5252
"Please use '--size' instead."

include/rtkGgoFunctions.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SetConstantImageSourceFromGgo(TConstantImageSourceType * source, const TArgsInfo
5454
const unsigned int Dimension = ImageType::GetImageDimension();
5555

5656
typename ImageType::SizeType imageSize;
57-
if (args_info.dimension_given)
57+
if (args_info.dimension_given && !args_info.size_given)
5858
{
5959
itkGenericOutputMacro(
6060
"Warning: --dimension is deprecated and will be removed in a future release. Use --size instead.");
@@ -64,9 +64,12 @@ SetConstantImageSourceFromGgo(TConstantImageSourceType * source, const TArgsInfo
6464
imageSize[i] = args_info.dimension_arg[i];
6565
}
6666
}
67-
imageSize.Fill(args_info.size_arg[0]);
68-
for (unsigned int i = 0; i < std::min(args_info.size_given, Dimension); i++)
69-
imageSize[i] = args_info.size_arg[i];
67+
else
68+
{
69+
imageSize.Fill(args_info.size_arg[0]);
70+
for (unsigned int i = 0; i < std::min(args_info.size_given, Dimension); i++)
71+
imageSize[i] = args_info.size_arg[i];
72+
}
7073

7174
typename ImageType::SpacingType imageSpacing;
7275
imageSpacing.Fill(args_info.spacing_arg[0]);

0 commit comments

Comments
 (0)