Skip to content

Commit 265b338

Browse files
Lee NewbergLeengit
authored andcommitted
BUG: Properly characterize size of VariableLengthVector
The signal of -1 to indicate that the size was variable was stored as an `unsigned int` and thus evaded a check that it was negative. Now it is stored as signed.
1 parent 37e67ec commit 265b338

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

include/itkStructurePreservingColorNormalizationFilter.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ class StructurePreservingColorNormalizationFilter : public ImageToImageFilter<TI
164164
{
165165
using PixelType = TPixelType;
166166
using ValueType = typename PixelType::ValueType;
167-
static constexpr SizeValueType NumberOfDimensions = -1; // unsigned int value!
168-
static constexpr SizeValueType NumberOfColors = -1; // unsigned int value!
167+
static constexpr typename Eigen::Index NumberOfDimensions{ -1 };
168+
static constexpr typename Eigen::Index NumberOfColors{ -1 };
169169
static constexpr typename Eigen::Index ColorIndexSuppressedByHematoxylin{ -1 };
170170
static constexpr typename Eigen::Index ColorIndexSuppressedByEosin{ -1 };
171171
static PixelType
@@ -402,10 +402,10 @@ class StructurePreservingColorNormalizationFilter : public ImageToImageFilter<TI
402402
CalcMatrixType m_ReferenceH;
403403
CalcRowVectorType m_ReferenceUnstainedPixel;
404404

405-
Eigen::Index m_NumberOfDimensions;
406-
Eigen::Index m_NumberOfColors;
407-
Eigen::Index m_ColorIndexSuppressedByHematoxylin;
408-
Eigen::Index m_ColorIndexSuppressedByEosin;
405+
Eigen::Index m_NumberOfDimensions{ Self::PixelHelper<PixelType>::NumberOfDimensions };
406+
Eigen::Index m_NumberOfColors{ Self::PixelHelper<PixelType>::NumberOfColors };
407+
Eigen::Index m_ColorIndexSuppressedByHematoxylin{ Self::PixelHelper<PixelType>::ColorIndexSuppressedByHematoxylin };
408+
Eigen::Index m_ColorIndexSuppressedByEosin{ Self::PixelHelper<PixelType>::ColorIndexSuppressedByEosin };
409409

410410
private:
411411
#ifdef ITK_USE_CONCEPT_CHECKING

include/itkStructurePreservingColorNormalizationFilter.hxx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ namespace itk
2828

2929
template <typename TImage>
3030
StructurePreservingColorNormalizationFilter<TImage>::StructurePreservingColorNormalizationFilter()
31-
: m_NumberOfDimensions(Self::PixelHelper<PixelType>::NumberOfDimensions)
32-
, m_NumberOfColors(Self::PixelHelper<PixelType>::NumberOfColors)
33-
, m_ColorIndexSuppressedByHematoxylin(Self::PixelHelper<PixelType>::ColorIndexSuppressedByHematoxylin)
34-
, m_ColorIndexSuppressedByEosin(Self::PixelHelper<PixelType>::ColorIndexSuppressedByEosin)
3531
{
3632
// The number of colors had better be at least 3 or be unknown
3733
// (which is indicated with the value -1).

0 commit comments

Comments
 (0)