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

Improve description of itkFastMarchingImageFilter exception: Discriminant of quadratic equation is negative #715

Open
romangrothausmann opened this issue Apr 10, 2019 · 11 comments
Labels
status:Backlog Postponed without a fixed deadline type:Design Improvement in the design of a given area type:Documentation Documentation improvement or change

Comments

@romangrothausmann
Copy link
Member

Description

itkFastMarchingImageFilter is called when executing itkSpeedFunctionToPathFilter. Under some circumstances itkFastMarchingImageFilter issues an exception with the description:
Discriminant of quadratic equation is negative

err.SetDescription("Discriminant of quadratic equation is negative");

However it is not obvious what the reason is that causes this problem. It is unclear when this condition is reached and how to avoid it (and if it depends on itkSpeedFunctionToPathFilter).

Impact analysis

It is good to have an error thrown and a description of the actual problem, as is the current case, but it would be good to have more details on why this happened and possibly how to avoid it.

Expected behavior

err.SetDescription("Discriminant of quadratic equation is negative. This happens when ... and can possibly be avoided by ...");

Actual behavior

I'm hitting this problem with one of my ITK-CLIs here:
https://github.com/romangrothausmann/ITK-CLIs/blob/e883088ebf6b19cf945ac01dec1ce81878f8c181/min-path_seg.cxx#L285-L291

It seems to be very input data dependent. The speed function that lead to this error is constructed by the sigmoid of a fast-marching map run inside a binary segmentation starting from the centerlines extracted by itkBinaryThinningImageFilter3D.
When using e.g. ParabolicOpenImageFilter on the binary segmentation (as built in) this error does not arise for otherwise same parameters.

Versions

Tested with ITK-4.13.1

@stale
Copy link

stale bot commented Aug 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status:Backlog Postponed without a fixed deadline label Aug 8, 2019
@romangrothausmann
Copy link
Member Author

I think this is still relevant and it is not clear to me when this happens.
@richardbeare Do you have an idea when this can happen?

@stale stale bot removed the status:Backlog Postponed without a fixed deadline label Aug 9, 2019
@richardbeare
Copy link
Contributor

I suspect it occurs when the speed function doesn't conform to the range rules (0-1).

@romangrothausmann
Copy link
Member Author

Hm, oddly I did get this exception even with the min-path_seg CLI where a RescaleIntensityImageFilter makes sure that the rane is within [0, 1]:
https://github.com/romangrothausmann/ITK-CLIs/blob/ee05ceb349fe012bff89718f46786bf847877975/min-path_seg.cxx#L165-L169
Are there cases where the RescaleIntensityImageFilter is not sufficiently precise such that values outside [0, 1] ought to be expected?

@richardbeare
Copy link
Contributor

Perhaps some issue with scaling of time step size when the voxels are small? I'm guessing as I don't know the fast marching internals. A test might be to reset voxel sizes of the problem images and see if the error disappears.

@romangrothausmann
Copy link
Member Author

A test might be to reset voxel sizes of the problem images and see if the error disappears.

Yes, this might be the problem, will test this.

@thewtex
Copy link
Member

thewtex commented Nov 13, 2019

The speed function that lead to this error is constructed by the sigmoid of a fast-marching map run inside a binary segmentation starting from the centerlines extracted by itkBinaryThinningImageFilter3D.

@romangrothausmann out of curiosity, what does this look like?

@romangrothausmann
Copy link
Member Author

I haven't got a 2D exmple ready, but basically it is a speed image whose profile perpendicular to the centerlines resembles a (cropped) sigmoid independent of the local extent of the orginal structure of the binary segmentation.

@stale
Copy link

stale bot commented Mar 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the status:Backlog Postponed without a fixed deadline label Mar 13, 2020
@romangrothausmann
Copy link
Member Author

@stale stale bot removed the status:Backlog Postponed without a fixed deadline label Mar 13, 2020
@stale
Copy link

stale bot commented Jul 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the status:Backlog Postponed without a fixed deadline label Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:Backlog Postponed without a fixed deadline type:Design Improvement in the design of a given area type:Documentation Documentation improvement or change
Projects
None yet
Development

No branches or pull requests

3 participants