Skip to content

COMP: Fix unit tests for OpenCV 4#5

Closed
nocnokneo wants to merge 1 commit into
Kitware:masterfrom
nocnokneo:OpenCV4
Closed

COMP: Fix unit tests for OpenCV 4#5
nocnokneo wants to merge 1 commit into
Kitware:masterfrom
nocnokneo:OpenCV4

Conversation

@nocnokneo
Copy link
Copy Markdown

@nocnokneo nocnokneo commented Jan 14, 2020

Fixes InsightSoftwareConsortium#806

PR Checklist

std::map<int, int> matDepthToIplDepth{ { CV_8U, IPL_DEPTH_8U }, { CV_8S, IPL_DEPTH_8S },
{ CV_16U, IPL_DEPTH_16U }, { CV_16S, IPL_DEPTH_16S },
{ CV_32S, IPL_DEPTH_32S }, { CV_32F, IPL_DEPTH_32F },
{ CV_64F, IPL_DEPTH_64F } };
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - I had to bypass the pre-commit hooks to avoid:

Modules/Video/BridgeOpenCV/test/itkOpenCVTestHelper.cxx:40: error: Unnecessary semicolon
pre-commit hook failure
-----------------------

KWStyle check failed.

@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented Feb 4, 2020

The PRs should be made against https://github.com/InsightSoftwareConsortium/ITK. https://github.com/Kitware/ITK is only a mirror.

@nocnokneo
Copy link
Copy Markdown
Author

Whoops, closing this in lieu of InsightSoftwareConsortium#1591

@nocnokneo nocnokneo closed this Feb 4, 2020
kwrobot pushed a commit that referenced this pull request May 5, 2026
Two upstream bugs caught by Greptile review on PR InsightSoftwareConsortium#6214:

1. WritePointData() printed to std::cerr and returned silently when
   m_PointPixelComponentType was UNKNOWNCOMPONENTTYPE, leaving the
   output file in a partially-written state.  Replace with
   itkExceptionMacro so the failure surfaces to the caller.

2. ~MZ3MeshIO() never closed m_Ofstream — a write that threw between
   WriteMeshInformation()'s open and Write()'s explicit close leaked
   the output stream.  Close both m_Ifstream and m_Ofstream in the
   destructor's uncompressed branch (guarded by is_open() so closing
   twice is safe).

Also rewrites the 20 C-style (char *)& casts on gzread / gzwrite /
ifstream / ofstream calls to reinterpret_cast<char *>(&...) per ITK
style guide (Greptile P2 #6).

Also fixes the WriteCells CHAR case that cast the buffer to
unsigned char * instead of char *, which would silently corrupt
negative vertex indices on signed cell-component types (Greptile P2
#5).
kwrobot pushed a commit that referenced this pull request May 15, 2026
Merge ITKBinaryThinning3D into master
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

Successfully merging this pull request may close these issues.

BridgeOpenCV fails to build with OpenCV 4

2 participants