[ITK-users] Segmentation fault in itkBinaryMask3DMeshSource

Mihail Isakov mihail.isakov at googlemail.com
Mon Aug 14 01:53:40 EDT 2017


On Fri, Aug 11, 2017 at 4:44 PM, Francois Budin
<francois.budin at kitware.com> wrote:

> I found that there was a limitation in the
> current implementation due to the fact that it uses "unsigned short"
> variables.

Thank you very much. Fantastic! I changed in itkBinaryMask3DMeshSource.h

unsigned short m_CurrentRowIndex;
unsigned short m_CurrentFrameIndex;
unsigned short m_LastRowNum;
unsigned short m_LastFrameNum;
unsigned short m_CurrentRowNum;
unsigned short m_CurrentFrameNum;

to 'int' and it works, no crashes.

BTW, IMHO, it looks like variables m_NodeLimit(2000) and int m_CellLimit(4000)
and allocations in constructor
this->GetOutput()->GetPoints()->Reserve(m_NodeLimit);
this->GetOutput()->GetCells()->Reserve(m_CellLimit);
don't have any effect and can be deleted... I generated huge meshes
without problems
very fast (with or without those limits and allocations).

Also i have seen that 3D binary images with dimension 1 cause
segmentation fault of filter too,
eg. this one
https://drive.google.com/file/d/0ByBLJ2-U1t9xS2VCa0RnVVdBYjg/view?usp=sharing
It not relevant to unsigned short issue above.
Of course such images should not be used at all to generate mesh,
the same for the first noisy image, but anyway for filter robustness
some precondition check might be
done. The filter is very good, very fast.

> Is it ok to add your data you shared in this

I am sorry, i asked the owner of the original data set i derived the
image from. Unfortunately he don't want to add it permanently to tests
due to some kind of policy. Sorry


Regards,
Mihail


More information about the Insight-users mailing list