Skip to content

Commit

Permalink
Starting to remove Vector2b/Vector3b because of ITK/VNL incompatibility"
Browse files Browse the repository at this point in the history
  • Loading branch information
pyushkevich committed Oct 4, 2024
1 parent ccbdd7d commit 24368d7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 56 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ SET(LOGIC_CXX
Common/HistoryManager.cxx
Common/IPCHandler.cxx
Common/IRISException.cxx
Common/IRISVectorTemplates.cxx
Common/MultiFrameDicomSeriesSorter.cxx
Common/Rebroadcaster.cxx
Common/Registry.cxx
Expand Down
29 changes: 0 additions & 29 deletions Common/IRISVectorTemplates.cxx
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@
#include <vnl/vnl_vector_fixed.h>
#include <vnl/vnl_vector_fixed.hxx>

#include <vnl/vnl_complex_traits.h>

template <> struct VNL_EXPORT vnl_complex_traits<bool>
{
enum { isreal = true };
static bool conjugate(bool x) { return x; }
static std::complex<bool> complexify(bool x) { return std::complex<bool>(x, (bool)0); }
};

#include <vnl/vnl_c_vector.hxx>

// Some types that are not instantiated in VNL itself
VNL_VECTOR_FIXED_INSTANTIATE(bool, 2);
VNL_VECTOR_FIXED_INSTANTIATE(bool, 3);
VNL_VECTOR_FIXED_INSTANTIATE(bool, 4);

template class vnl_c_vector<bool>;

#include <vnl/vnl_vector.hxx>
VNL_VECTOR_INSTANTIATE(bool);

#include <vnl/vnl_vector_ref.hxx>
VNL_VECTOR_REF_INSTANTIATE(bool);

#include <vnl/vnl_matrix.hxx>
VNL_MATRIX_INSTANTIATE(bool);
3 changes: 0 additions & 3 deletions Common/IRISVectorTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,18 @@ typedef iris_vector_fixed<int,2> Vector2i;
typedef iris_vector_fixed<unsigned int,2> Vector2ui;
typedef iris_vector_fixed<float,2> Vector2f;
typedef iris_vector_fixed<double,2> Vector2d;
typedef iris_vector_fixed<bool,2> Vector2b;

// Common 3D vector types
typedef iris_vector_fixed<int,3> Vector3i;
typedef iris_vector_fixed<unsigned int,3> Vector3ui;
typedef iris_vector_fixed<float,3> Vector3f;
typedef iris_vector_fixed<double,3> Vector3d;
typedef iris_vector_fixed<bool,3> Vector3b;

// Common 3D vector types
typedef iris_vector_fixed<int,4> Vector4i;
typedef iris_vector_fixed<unsigned int,4> Vector4ui;
typedef iris_vector_fixed<long,4> Vector4l;
typedef iris_vector_fixed<double,4> Vector4d;
typedef iris_vector_fixed<bool,4> Vector4b;

// A matrix definition
typedef vnl_matrix_fixed<double,3,3> Matrix3d;
Expand Down
3 changes: 0 additions & 3 deletions Common/PropertyModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,6 @@ MAKE_TYPEDEF_PM_RANGED(Vector4i, IntVec4)
MAKE_TYPEDEF_PM_RANGED(Vector2ui, UIntVec2)
MAKE_TYPEDEF_PM_RANGED(Vector3ui, UIntVec3)
MAKE_TYPEDEF_PM_RANGED(Vector4ui, UIntVec4)
MAKE_TYPEDEF_PM_RANGED(Vector2b, BooleanVec2)
MAKE_TYPEDEF_PM_RANGED(Vector3b, BooleanVec3)
MAKE_TYPEDEF_PM_RANGED(Vector4b, BooleanVec4)

// Macros for non-ranged types
MAKE_TYPEDEF_PM_NONRNG(std::string, String)
Expand Down
8 changes: 4 additions & 4 deletions GUI/Model/LabelEditorModel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void LabelEditorModel::SetCurrentLabelOpacity(int value)
}
}

bool LabelEditorModel::GetCurrentLabelHiddenState(iris_vector_fixed<bool, 2> &value)
bool LabelEditorModel::GetCurrentLabelHiddenState(Vector2i &value)
{
if(GetAndStoreCurrentLabel())
{
Expand All @@ -141,7 +141,7 @@ bool LabelEditorModel::GetCurrentLabelHiddenState(iris_vector_fixed<bool, 2> &va
return false;
}

void LabelEditorModel::SetCurrentLabelHiddenState(iris_vector_fixed<bool, 2> value)
void LabelEditorModel::SetCurrentLabelHiddenState(Vector2i value)
{
if(GetAndStoreCurrentLabel())
{
Expand Down Expand Up @@ -174,7 +174,7 @@ void LabelEditorModel::SetCurrentLabelColor(Vector3ui value)
}
}

bool LabelEditorModel::GetIsForegroundBackground(Vector2b &value)
bool LabelEditorModel::GetIsForegroundBackground(Vector2i &value)
{
if(GetAndStoreCurrentLabel())
{
Expand All @@ -188,7 +188,7 @@ bool LabelEditorModel::GetIsForegroundBackground(Vector2b &value)
return false;
}

void LabelEditorModel::SetIsForegroundBackground(Vector2b value)
void LabelEditorModel::SetIsForegroundBackground(Vector2i value)
{
GlobalState *gs = m_Parent->GetGlobalState();
if(GetAndStoreCurrentLabel())
Expand Down
16 changes: 8 additions & 8 deletions GUI/Model/LabelEditorModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class LabelEditorModel : public AbstractModel
irisGetMacro(CurrentLabelOpacityModel, AbstractRangedIntProperty *)

/** Get the model for the current label id */
irisGetMacro(CurrentLabelHiddenStateModel, AbstractSimpleBooleanVec2Property *)
irisGetMacro(CurrentLabelHiddenStateModel, AbstractSimpleIntVec2Property *)

/** Get the model for the current label id */
irisGetMacro(CurrentLabelColorModel, AbstractSimpleUIntVec3Property *)

/** Get the model that specifies whether the current label is background or
* foreground label */
irisGetMacro(IsForegroundBackgroundModel, AbstractSimpleBooleanVec2Property *)
irisGetMacro(IsForegroundBackgroundModel, AbstractSimpleIntVec2Property *)

/** Change the label id of the selected label */
bool ReassignLabelId(LabelType newid);
Expand Down Expand Up @@ -101,19 +101,19 @@ class LabelEditorModel : public AbstractModel
void SetCurrentLabelDescription(std::string value);

// Visibility of the current label
SmartPtr<AbstractSimpleBooleanVec2Property> m_CurrentLabelHiddenStateModel;
bool GetCurrentLabelHiddenState(iris_vector_fixed<bool, 2> &value);
void SetCurrentLabelHiddenState(iris_vector_fixed<bool, 2> value);
SmartPtr<AbstractSimpleIntVec2Property> m_CurrentLabelHiddenStateModel;
bool GetCurrentLabelHiddenState(Vector2i &value);
void SetCurrentLabelHiddenState(Vector2i value);

// Color of the current label
SmartPtr<AbstractSimpleUIntVec3Property> m_CurrentLabelColorModel;
bool GetCurrentLabelColor(Vector3ui &value);
void SetCurrentLabelColor(Vector3ui value);

// Foreground/background status
SmartPtr<AbstractSimpleBooleanVec2Property> m_IsForegroundBackgroundModel;
bool GetIsForegroundBackground(Vector2b &value);
void SetIsForegroundBackground(Vector2b value);
SmartPtr<AbstractSimpleIntVec2Property> m_IsForegroundBackgroundModel;
bool GetIsForegroundBackground(Vector2i &value);
void SetIsForegroundBackground(Vector2i value);

// The parent model
GlobalUIModel *m_Parent;
Expand Down
6 changes: 3 additions & 3 deletions GUI/Model/RegistrationModel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ void RegistrationModel::ResetTransformToIdentity()
offset.Fill(0.0);

// Reset the flips
this->m_ManualParam.Flip.fill(false);
this->m_ManualParam.Flip.fill(0);
this->SetMovingTransform(matrix, offset);
}

Expand Down Expand Up @@ -1257,7 +1257,7 @@ void RegistrationModel::SetScalingValue(Vector3d value)
this->UpdateWrapperFromManualParameters();
}

bool RegistrationModel::GetFlipValue(Vector3b &value)
bool RegistrationModel::GetFlipValue(Vector3i &value)
{
// Make sure that the manual parameters are valid
if(m_ManualParam.LayerID == NOID)
Expand All @@ -1269,7 +1269,7 @@ bool RegistrationModel::GetFlipValue(Vector3b &value)
return true;
}

void RegistrationModel::SetFlipValue(Vector3b value)
void RegistrationModel::SetFlipValue(Vector3i value)
{
// Update the flips
m_ManualParam.Flip = value;
Expand Down
10 changes: 5 additions & 5 deletions GUI/Model/RegistrationModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RegistrationModel : public AbstractModel
irisGetMacro(ScalingModel, AbstractRangedDoubleVec3Property *)

/** Scaling factor */
irisGetMacro(FlipModel, AbstractSimpleBooleanVec3Property *)
irisGetMacro(FlipModel, AbstractSimpleIntVec3Property *)

/** Logarithm of the scaling factor - for the slider */
irisGetMacro(LogScalingModel, AbstractRangedDoubleVec3Property *)
Expand Down Expand Up @@ -214,9 +214,9 @@ class RegistrationModel : public AbstractModel
bool GetScalingValueAndRange(Vector3d &value, NumericValueRange<Vector3d> *range);
void SetScalingValue(Vector3d value);

SmartPtr<AbstractSimpleBooleanVec3Property> m_FlipModel;
bool GetFlipValue(Vector3b &value);
void SetFlipValue(Vector3b value);
SmartPtr<AbstractSimpleIntVec3Property> m_FlipModel;
bool GetFlipValue(Vector3i &value);
void SetFlipValue(Vector3i value);

SmartPtr<AbstractRangedDoubleVec3Property> m_LogScalingModel;
bool GetLogScalingValueAndRange(Vector3d &value, NumericValueRange<Vector3d> *range);
Expand Down Expand Up @@ -283,7 +283,7 @@ class RegistrationModel : public AbstractModel
itk::TimeStamp UpdateTime;

// Flipping
Vector3b Flip;
Vector3i Flip;

TransformManualParameters() : LayerID(NOID) {}
};
Expand Down

0 comments on commit 24368d7

Please sign in to comment.