Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThresholdImage not good with unsigned chars. #85

Closed
muschellij2 opened this issue Jun 6, 2019 · 0 comments
Closed

ThresholdImage not good with unsigned chars. #85

muschellij2 opened this issue Jun 6, 2019 · 0 comments

Comments

@muschellij2
Copy link
Collaborator

Describe the bug
labelClusters doesn't perform well on unsigned chars. This is really a bug in thresholdImage:

library(ANTsRCore)
#> 
#> Attaching package: 'ANTsRCore'
#> The following object is masked from 'package:stats':
#> 
#>     var
#> The following objects are masked from 'package:base':
#> 
#>     all, any, apply, max, min, prod, range, sum
minThresh = 1e-06
maxThresh = 1
fullyConnected = FALSE
imagein<-makeImage( c(40,10,10 ) , rnorm(40*10*10))
imagein = check_ants(imagein)
dim <- imagein@dimension
clust <- thresholdImage(imagein > 1, minThresh, 0.99)
sum(clust)
#> [1] 0
clust <- thresholdImage(antsImageClone(imagein > 1,
                                       out_pixeltype = "float"), 
                        minThresh, maxThresh)
sum(clust)
#> [1] 620
sum(imagein > 0)
#> [1] 2034
cc = labelClusters(imagein > 0)
sum(cc)
#> [1] 0
cc
#> antsImage
#>   Pixel Type          : unsigned char 
#>   Components Per Pixel: 1 
#>   Dimensions          : 40x10x10 
#>   Voxel Spacing       : 1x1x1 
#>   Origin              : 0 0 0 
#>   Direction           : 1 0 0 0 1 0 0 0 1
cc2 = labelClusters(antsImageClone(imagein > 0, out_pixeltype = "float"))
sum(cc2)
#> [1] 1964
cc2
#> antsImage
#>   Pixel Type          : float 
#>   Components Per Pixel: 1 
#>   Dimensions          : 40x10x10 
#>   Voxel Spacing       : 1x1x1 
#>   Origin              : 0 0 0 
#>   Direction           : 1 0 0 0 1 0 0 0 1

Created on 2019-06-06 by the reprex package (v0.2.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant