integers should be handled by converting them to floats first.
(self)
| 48 | assert_allclose(result, expected, type_test="tensor", rtol=1e-3, atol=1e-3) |
| 49 | |
| 50 | def test_int(self): |
| 51 | """integers should be handled by converting them to floats first.""" |
| 52 | for p in TEST_NDARRAYS: |
| 53 | scaler = ScaleIntensity(minv=1.0, maxv=2.0) |
| 54 | result = scaler(p(self.imt.astype(int))) |
| 55 | _imt = self.imt.astype(int).astype(np.float32) |
| 56 | mina = _imt.min() |
| 57 | maxa = _imt.max() |
| 58 | norm = (_imt - mina) / (maxa - mina) |
| 59 | expected = p((norm * (2.0 - 1.0)) + 1.0) |
| 60 | assert_allclose(result, expected, type_test="tensor", rtol=1e-7, atol=0) |
| 61 | |
| 62 | def test_channel_wise(self): |
| 63 | for p in TEST_NDARRAYS: |
nothing calls this directly
no test coverage detected