InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

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

Open
#715 11 comments 0 reactions 0 assignees View on GitHub
status:Use_Milestone_Backlog type:Design type:Documentation
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

`itkFastMarchingImageFilter` is called when executing `itkSpeedFunctionToPathFilter`. Under some circumstances `itkFastMarchingImageFilter` issues an exception with the description:
`Discriminant of quadratic equation is negative`
https://github.com/InsightSoftwareConsortium/ITK/blob/bd8169b433679930c8acfe0e24c8b5a5c663a833/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx#L498
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

```c++
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.