We patrolled your repo and found the following:
There are multiple instances of undocumented use of magic numbers, like:
|
mind = mind[:, torch.Tensor([6, 8, 1, 11, 2, 10, 0, 7, 9, 4, 5, 3]).long(), :, :, :] |
(we get the intended logic, however it seems arbitrary, error prone and significantly limits comprehensibility)
|
for ii,i in enumerate((1,7,8,14,18,20,21,28,1,2,3,4,5,6,7,8,9,10,1,2,3,5,6,8,9,11,12,14,17,19)): |
as well as
|
for ii,i in enumerate((1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,7,8,14,18,20,21,28)): |
(those numbers look like case IDs, but the overall selection and ordering is unclear/undocumented. Again this is error prone and limits comprehensibility)
|
keypts_fix = torch.stack((corrfield[:,2+0]/207*2-1,corrfield[:,1+0]/191*2-1,corrfield[:,0+0]/191*2-1),1).cuda() |
|
keypts_mov = torch.stack((corrfield[:,2+3]/207*2-1,corrfield[:,1+3]/191*2-1,corrfield[:,0+3]/191*2-1),1).cuda() |
|
if((ii>=8)&(ii<18)): |
|
keypts_mov = torch.stack((corrfield[:,2+0]/207*2-1,corrfield[:,1+0]/191*2-1,corrfield[:,0+0]/191*2-1),1).cuda() |
|
keypts_fix = torch.stack((corrfield[:,2+3]/207*2-1,corrfield[:,1+3]/191*2-1,corrfield[:,0+3]/191*2-1),1).cuda() |
(we figure that the numbers
207, 191, are somehow correlated to the image shape and are used to transform the displacement field to the range of
[-1, +1]. Furthermore, please explain the addition operations like
2+0,
2+3)
This is obviously an undocumented magic number and requires explanation
|
idx_test_all = torch.tensor([[0,1,15,16],[2,3,10,11],[4,5,17,18],[6,7,12,13],[8,9,14,19]]) |
Those numbers are (based on the variable naming) test case indices, however why is the tensor multi-dimensional (shape: (5, 4))
We patrolled your repo and found the following:
There are multiple instances of undocumented use of magic numbers, like:
Learn2Optimise/l2r_heatmorph_utils.py
Line 67 in ecbf0b4
(we get the intended logic, however it seems arbitrary, error prone and significantly limits comprehensibility)
Learn2Optimise/l2r_heatmorph_utils.py
Line 364 in ecbf0b4
as well as
Learn2Optimise/learn2optimise_3dall_folds.py
Line 52 in ecbf0b4
(those numbers look like case IDs, but the overall selection and ordering is unclear/undocumented. Again this is error prone and limits comprehensibility)
Learn2Optimise/l2r_heatmorph_utils.py
Lines 397 to 401 in ecbf0b4
(we figure that the numbers
207, 191,are somehow correlated to the image shape and are used to transform the displacement field to the range of[-1, +1]. Furthermore, please explain the addition operations like2+0,2+3)Learn2Optimise/l2r_heatmorph_utils.py
Line 407 in ecbf0b4
This is obviously an undocumented magic number and requires explanation
Learn2Optimise/learn2optimise_3dall_folds.py
Line 255 in ecbf0b4
Those numbers are (based on the variable naming) test case indices, however why is the tensor multi-dimensional (shape: (5, 4))