Hi I use SimpleITK python, and this is issue is specific to the python wrapper.
I frequently use loops to create remapping dictionary for labelmaps. However, I get an error from ITK
in method 'ChangeLabelLabelMap', argument 2 of type 'std::map< double,double,std::less< double >,std::allocator< std::pair< double const,double > >
when using loops. Below script will illustrate the issue:
img = sitk.Image([10,10], sitk.sitkLabelUInt16)
img[1,2] = 1
remapping = {x:0 for x in np.arange(1, 3)}
result = sitk.ChangeLabelLabelMap(img, remapping)
remapping2 = {1:0, 2:0}
print(remapping == remapping2)
result = sitk.ChangeLabelLabelMap(img, remapping2)
result[1,2]