-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
First of all, thank you for implementing this library, it is useful to have different stain normalization algorithms with a simple pip install.
Describe the bug
Macenko normalizer changes the image shape and dtype after normalization,
which requires additional steps in the dataloader which is unexpected and unnecessary.
To Reproduce
H, W, C = 100, 100, 3
target = torch.rand(C, H, W).to(torch.float32)
query = torch.rand(C, H, W).to(torch.float32)
normalizer = torchstain.normalizers.MacenkoNormalizer(backend="torch")
normalizer.fit(target)
query_norm = normalizer.normalize(query)[0]
assert query_norm.shape == query.shape, f'{query_norm.shape} == {query.shape}'
assert query_norm.dtype == query.dtype, f'{query_norm.dtype} == {query.dtype}'
the output is
AssertionError: torch.Size([100, 100, 3]) == torch.Size([3, 100, 100])
AssertionError: torch.int32 == torch.float32
Expected behavior
Image before and after normalization should be the same shape and type.
andreped and Jeffery-MIC
Metadata
Metadata
Assignees
Labels
No labels