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

LabelOverlapMeasures added #104

Closed
muschellij2 opened this issue Nov 7, 2019 · 6 comments
Closed

LabelOverlapMeasures added #104

muschellij2 opened this issue Nov 7, 2019 · 6 comments
Assignees

Comments

@muschellij2
Copy link
Collaborator

I think adding https://github.com/ANTsX/ANTs/blob/master/Examples/LabelOverlapMeasures.cxx would be a great addition to the ANTsRCore package. I need Hausdorff distance for some of my research and it seems like ANTsX/ANTs#611 has indicated that this should be fixed, but ANTsX/ANTs@295ae80 had the hausdorff distance, but it seemed it was immediately removed from @ntustison in ANTsX/ANTs@119dd3b#diff-267dd586075f89a331c8b476d18fe752

Describe the solution you'd like
LabelOverlapMeasures.cpp for overlap measures (including Hausdorff and ASD)

Describe alternatives you've considered
You can do this in R, but seems like the ITK functionality is more optimized for this function.

@ntustison
Copy link
Member

I removed the code because of a pre-existing class for calculating the Hausdorff distance. It would be easy to include that class, if needed.

@muschellij2
Copy link
Collaborator Author

muschellij2 commented Nov 7, 2019 via email

@muschellij2
Copy link
Collaborator Author

Regardless, can close but would be interested in the discussion.

@stnava
Copy link
Member

stnava commented Nov 7, 2019

in brief:

max( iMath( segmentation, "D" ) * segmentation )

something like this.

@stnava
Copy link
Member

stnava commented Nov 7, 2019

hausdorffDistance <- function( binarySeg1, binarySeg2 ) {
  d1 = iMath( binarySeg1, "MaurerDistance" ) * binarySeg2
  d2 = iMath( binarySeg2, "MaurerDistance ) * binarySeg1
  return( max( c( max( abs( d1 ) ), max( abs( d2 ) ) ) ) )
}
seg1 = thresholdImage( ri( 1 ), "Otsu", 3 ) %>% thresholdImage( 2, 2 )
seg2 = thresholdImage( ri( 2 ), "Otsu", 3 ) %>% thresholdImage( 2, 2 )
seg5 = thresholdImage( ri( 5 ), "Otsu", 3 ) %>% thresholdImage( 2, 2 )
hausdorffDistance( seg1, seg2 )
hausdorffDistance( seg1, seg5 )

probably close to correct

@stnava
Copy link
Member

stnava commented Nov 7, 2019

note update - need MaurerDistance because it gives signed distance.

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

3 participants