Skip to content

Commit c0adec1

Browse files
committed
COMP: Adopt VXL private vnl_vector ivars via protected_set_data
Switch itk::Array<T> to vnl_vector::protected_set_data and turn off VXL_USE_HISTORICAL_PROTECTED_IVARS so ITK builds against VXL >= 7.0.0 (where vnl_vector::data and num_elmts are private). Bumps Modules/ThirdParty/VNL/CMakeLists.txt find_package floor 3.0.0 to 4.0.0 (protected_set_data first shipped in VXL v3.3.0).
1 parent a4fed47 commit c0adec1

2 files changed

Lines changed: 14 additions & 31 deletions

File tree

Modules/Core/Common/include/itkArray.hxx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ template <typename TValue>
5454
Array<TValue>::Array(ValueType * datain, SizeValueType sz, bool LetArrayManageMemory)
5555
: m_LetArrayManageMemory(LetArrayManageMemory)
5656
{
57-
vnl_vector<TValue>::data = datain;
58-
vnl_vector<TValue>::num_elmts = sz;
57+
vnl_vector<TValue>::protected_set_data(datain, sz, false);
5958
}
6059

6160
#if defined(ITK_LEGACY_REMOVE)
@@ -82,7 +81,7 @@ Array<TValue>::~Array()
8281
{
8382
if (!m_LetArrayManageMemory)
8483
{
85-
vnl_vector<TValue>::data = nullptr;
84+
vnl_vector<TValue>::protected_set_data(nullptr, 0, false);
8685
}
8786
}
8887

@@ -94,8 +93,7 @@ Array<TValue>::SetDataSameSize(TValue * datain, bool LetArrayManageMemory)
9493
{
9594
vnl_vector<TValue>::destroy();
9695
}
97-
vnl_vector<TValue>::data = datain;
98-
// NOTE: Required to have same size vnl_vector< TValue >::num_elmts = sz;
96+
vnl_vector<TValue>::protected_set_data(datain, this->size(), false);
9997
m_LetArrayManageMemory = LetArrayManageMemory;
10098
}
10199

@@ -107,8 +105,7 @@ Array<TValue>::SetData(TValue * datain, SizeValueType sz, bool LetArrayManageMem
107105
{
108106
vnl_vector<TValue>::destroy();
109107
}
110-
vnl_vector<TValue>::data = datain;
111-
vnl_vector<TValue>::num_elmts = sz;
108+
vnl_vector<TValue>::protected_set_data(datain, sz, false);
112109
m_LetArrayManageMemory = LetArrayManageMemory;
113110
}
114111

@@ -122,7 +119,7 @@ Array<TValue>::SetSize(SizeValueType sz)
122119
// on a resize
123120
if (!m_LetArrayManageMemory)
124121
{
125-
vnl_vector<TValue>::data = nullptr;
122+
vnl_vector<TValue>::protected_set_data(nullptr, 0, false);
126123
}
127124

128125
// Call the superclass's set_size

Modules/ThirdParty/VNL/CMakeLists.txt

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ option(ITK_USE_SYSTEM_VXL "Use an outside build of VXL." OFF)
55
mark_as_advanced(ITK_USE_SYSTEM_VXL)
66

77
if(ITK_USE_SYSTEM_VXL)
8-
find_package(VXL 3.0.0 REQUIRED)
9-
# 3.0.0 is the first version of VXL that supports
10-
# the requirement of front() and back() members
11-
# in the vnl_vector and vnl_vector_fixed.
8+
find_package(VXL 4.0.0 REQUIRED)
129
set(
1310
ITKVNL_SYSTEM_INCLUDE_DIRS
1411
${VXL_NETLIB_INCLUDE_DIR}
@@ -103,27 +100,16 @@ else()
103100
# set(VXL_USE_DCMTK OFF CACHE BOOL "VXL configuration for ITK" FORCE) # <- Not visible in itk extracted code
104101
# set(VXL_USE_ECW OFF CACHE BOOL "VXL configuration for ITK" FORCE) # <- Visible, but unreachable in itk extracted code
105102
set(VXL_USE_GEOTIFF OFF CACHE BOOL "VXL configuration for ITK" FORCE)
106-
if(ITK_LEGACY_REMOVE OR ITK_FUTURE_LEGACY_REMOVE)
107-
set(
108-
VXL_USE_HISTORICAL_IMPLICIT_CONVERSIONS
109-
OFF
110-
CACHE BOOL
111-
"Allow default deprecated implicit conversions."
112-
FORCE
113-
)
114-
else()
115-
set(
116-
VXL_USE_HISTORICAL_IMPLICIT_CONVERSIONS
117-
ON
118-
CACHE BOOL
119-
"Allow default deprecated implicit conversions."
120-
FORCE
121-
)
122-
endif()
123-
# MUST ALWAYS BE ON currently
103+
set(
104+
VXL_USE_HISTORICAL_IMPLICIT_CONVERSIONS
105+
OFF
106+
CACHE BOOL
107+
"Allow default deprecated implicit conversions."
108+
FORCE
109+
)
124110
set(
125111
VXL_USE_HISTORICAL_PROTECTED_IVARS
126-
ON
112+
OFF
127113
CACHE BOOL
128114
"VXL configuration for ITK"
129115
FORCE

0 commit comments

Comments
 (0)