Skip to content

Commit

Permalink
Rearrange the parameters a bit to make the flow more logical.
Browse files Browse the repository at this point in the history
The user should start from the "top down" when filling out the parameters.

1: Name
2: Type
3: Number of Tuples
4: Number of Components
5: Initialize values.

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Sep 19, 2024
1 parent f7edaa5 commit a5adca0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ DataStore<UnderlyingType_t<PixelT>> ConvertImageToDataStore(itk::Image<PixelT, D
return dataStore;
}

// clang-format off
template <typename T>
concept NotBoolT = !std::is_same_v<T, bool>;
// clang-format on

template <NotBoolT NewStoreT, class PixelT, uint32 Dimension>
Result<> ConvertImageToDataStore(DataStore<NewStoreT>& dataStore, itk::Image<PixelT, Dimension>& image)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,33 @@ Parameters CreateDataArrayAdvancedFilter::parameters() const
{
Parameters params;

params.insertSeparator(Parameters::Separator{"Input Parameter(s)"});
params.insertSeparator(Parameters::Separator{"Output Data Array"});
params.insert(std::make_unique<ArrayCreationParameter>(k_DataPath_Key, "Created Array", "Array storing the data", DataPath({"Data"})));
params.insert(std::make_unique<NumericTypeParameter>(k_NumericType_Key, "Output Numeric Type", "Numeric Type of data to create", NumericType::int32));
params.insert(std::make_unique<DataStoreFormatParameter>(k_DataFormat_Key, "Data Format",
"This value will specify which data format is used by the array's data store. An empty string results in in-memory data store.", ""));

params.insertSeparator(Parameters::Separator{"Tuple Dimensions"});
params.insertLinkableParameter(std::make_unique<BoolParameter>(
k_AdvancedOptions_Key, "Set Tuple Dimensions [not required if creating inside an existing Attribute Matrix]",
"This allows the user to set the tuple dimensions directly rather than just inheriting them. This option is NOT required if you are creating the Data Array in an Attribute Matrix", true));

params.insertSeparator(Parameters::Separator{"Component Handling"});
{
DynamicTableInfo tableInfo;
tableInfo.setRowsInfo(DynamicTableInfo::StaticVectorInfo(1));
tableInfo.setColsInfo(DynamicTableInfo::DynamicVectorInfo(1, "TUPLE DIM {}"));
params.insert(std::make_unique<DynamicTableParameter>(k_TupleDims_Key, "Data Array Tuple Dimensions (Slowest to Fastest Dimensions)",
"Slowest to Fastest Dimensions. Note this might be opposite displayed by an image geometry.", tableInfo));
}

params.insertSeparator(Parameters::Separator{"Component Dimensions"});
{
DynamicTableInfo::TableDataType defaultValues = {{1ULL}};
DynamicTableInfo tableInfo;
tableInfo.setRowsInfo(DynamicTableInfo::StaticVectorInfo(1));
tableInfo.setColsInfo(DynamicTableInfo::DynamicVectorInfo(1, "COMP DIM {}"));
params.insert(std::make_unique<DynamicTableParameter>(k_CompDims_Key, "Data Array Component Dimensions (Slowest to Fastest Dimensions)", "Slowest to Fastest Component Dimensions.", tableInfo));
params.insert(std::make_unique<DynamicTableParameter>(k_CompDims_Key, "Data Array Component Dimensions (Slowest to Fastest Dimensions)", "Slowest to Fastest Component Dimensions.", defaultValues,
tableInfo));
}

params.insertSeparator(Parameters::Separator{"Initialization Options"});
Expand Down Expand Up @@ -107,24 +125,6 @@ Parameters CreateDataArrayAdvancedFilter::parameters() const
std::make_unique<StringParameter>(k_InitStartRange_Key, "Initialization Start Range [Seperated with ;]", "[Inclusive] The lower bound initialization range for random values", "0;0;0"));
params.insert(std::make_unique<StringParameter>(k_InitEndRange_Key, "Initialization End Range [Seperated with ;]", "[Inclusive] The upper bound initialization range for random values", "1;1;1"));

params.insertSeparator(Parameters::Separator{"Output Data Array"});
params.insert(std::make_unique<ArrayCreationParameter>(k_DataPath_Key, "Created Array", "Array storing the data", DataPath{}));
params.insert(std::make_unique<DataStoreFormatParameter>(k_DataFormat_Key, "Data Format",
"This value will specify which data format is used by the array's data store. An empty string results in in-memory data store.", ""));

params.insertSeparator(Parameters::Separator{"Tuple Handling"});
params.insertLinkableParameter(std::make_unique<BoolParameter>(
k_AdvancedOptions_Key, "Set Tuple Dimensions [not required if creating inside an Attribute Matrix]",
"This allows the user to set the tuple dimensions directly rather than just inheriting them. This option is NOT required if you are creating the Data Array in an Attribute Matrix", true));

{
DynamicTableInfo tableInfo;
tableInfo.setRowsInfo(DynamicTableInfo::StaticVectorInfo(1));
tableInfo.setColsInfo(DynamicTableInfo::DynamicVectorInfo(1, "TUPLE DIM {}"));
params.insert(std::make_unique<DynamicTableParameter>(k_TupleDims_Key, "Data Array Tuple Dimensions (Slowest to Fastest Dimensions)",
"Slowest to Fastest Dimensions. Note this might be opposite displayed by an image geometry.", tableInfo));
}

// Associate the Linkable Parameter(s) to the children parameters that they control
params.linkParameters(k_AdvancedOptions_Key, k_TupleDims_Key, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,13 @@ Parameters CreateDataArrayFilter::parameters() const
{
Parameters params;

params.insertSeparator(Parameters::Separator{"Input Parameter(s)"});
params.insert(std::make_unique<NumericTypeParameter>(k_NumericType_Key, "Output Numeric Type", "Numeric Type of data to create", NumericType::int32));
params.insert(std::make_unique<StringParameter>(k_InitializationValue_Key, "Initialization Value", "This value will be used to fill the new array", "0"));
params.insert(std::make_unique<UInt64Parameter>(k_NumComps_Key, "Number of Components", "Number of components", 1));

params.insertSeparator(Parameters::Separator{"Output Data Array"});
params.insert(std::make_unique<ArrayCreationParameter>(k_DataPath_Key, "Created Array", "Array storing the data", DataPath{}));
params.insert(std::make_unique<ArrayCreationParameter>(k_DataPath_Key, "Created Array", "Array storing the data", DataPath({"Data"})));
params.insert(std::make_unique<NumericTypeParameter>(k_NumericType_Key, "Output Numeric Type", "Numeric Type of data to create", NumericType::int32));
params.insert(std::make_unique<DataStoreFormatParameter>(k_DataFormat_Key, "Data Format",
"This value will specify which data format is used by the array's data store. An empty string results in in-memory data store.", ""));

params.insertSeparator(Parameters::Separator{"Tuple Handling"});
params.insertSeparator(Parameters::Separator{"Tuple Dimensions"});
params.insertLinkableParameter(std::make_unique<BoolParameter>(
k_AdvancedOptions_Key, "Set Tuple Dimensions [not required if creating inside an Attribute Matrix]",
"This allows the user to set the tuple dimensions directly rather than just inheriting them. This option is NOT required if you are creating the Data Array in an Attribute Matrix", true));
Expand All @@ -92,6 +88,12 @@ Parameters CreateDataArrayFilter::parameters() const
params.insert(std::make_unique<DynamicTableParameter>(k_TupleDims_Key, "Data Array Dimensions (Slowest to Fastest Dimensions)",
"Slowest to Fastest Dimensions. Note this might be opposite displayed by an image geometry.", tableInfo));

params.insertSeparator(Parameters::Separator{"Component Dimensions"});
params.insert(std::make_unique<UInt64Parameter>(k_NumComps_Key, "Total Number of Components", "Total number of components. Do not set the component dimensions.", 1));

params.insertSeparator(Parameters::Separator{"Initialization Options"});
params.insert(std::make_unique<StringParameter>(k_InitializationValue_Key, "Initialization Value", "This value will be used to fill the new array", "0"));

// Associate the Linkable Parameter(s) to the children parameters that they control
params.linkParameters(k_AdvancedOptions_Key, k_TupleDims_Key, true);

Expand Down

0 comments on commit a5adca0

Please sign in to comment.