Re: [ITK-users] Segmentation fault in itkBinaryMask3DMeshSource

Mihail Isakov via Insight-users <[email protected]>
Newsgroups gmane.comp.lib.itk.user
Message-ID <CAJYHnFLu5TPyqRfuRPwvV5oART9hPM4q4BfZkR6pXf3+v_B94Q@mail.gmail.com>
On Fri, Aug 11, 2017 at 4:44 PM, Francois Budin
<[email protected]> 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
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.