Skip to content

Commit b878202

Browse files
authored
fix bug in assoc mode config with width and height (#605)
1 parent 96d4079 commit b878202

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

SEImplementation/src/lib/Plugin/AssocMode/AssocModeConfig.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ void AssocModeConfig::readConfigFromParams(const UserValues& args) {
218218
m_pixel_width_column = args.at(ASSOC_SOURCE_SIZES).as<int>() - 1; // config uses 1 as first column
219219
m_pixel_height_column = args.at(ASSOC_SOURCE_SIZES).as<int>() - 1; // config uses 1 as first column
220220

221-
if (args.find(ASSOC_SOURCE_WIDTHS) != args.end()) {
221+
if (args.find(ASSOC_SOURCE_WIDTHS) != args.end() && args.at(ASSOC_SOURCE_WIDTHS).as<int>() > 0) {
222222
m_pixel_width_column = args.at(ASSOC_SOURCE_WIDTHS).as<int>() - 1; // config uses 1 as first column
223223
}
224-
if (args.find(ASSOC_SOURCE_HEIGHTS) != args.end()) {
224+
if (args.find(ASSOC_SOURCE_HEIGHTS) != args.end() && args.at(ASSOC_SOURCE_HEIGHTS).as<int>() > 0) {
225225
m_pixel_height_column = args.at(ASSOC_SOURCE_HEIGHTS).as<int>() - 1; // config uses 1 as first column
226226
}
227227

@@ -280,7 +280,7 @@ void AssocModeConfig::readConfigFromFile(const std::string& filename) {
280280
}
281281

282282
if (m_assoc_columns.find("pixel_height") != m_assoc_columns.end()) {
283-
m_pixel_width_column = m_assoc_columns.at("pixel_height");
283+
m_pixel_height_column = m_assoc_columns.at("pixel_height");
284284
m_assoc_columns.erase("pixel_height");
285285
}
286286

@@ -491,6 +491,7 @@ void AssocModeConfig::printConfig() {
491491
if (m_columns.size() >= 3) {
492492
std::cout << "WEIGHT" << "\t";
493493
}
494+
494495
if (m_pixel_width_column >= 0) {
495496
std::cout << "PIXEL_WIDTH" << "\t";
496497
}

0 commit comments

Comments
 (0)