BUG: Convert Hexagonal Grid Data to Square Grid Data rejects an .ang file with an uppercase extension
Los mantenedores suelen responder en 4 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
Línea de trabajo
Empieza en ConvertHexGridToSquareGridFilter.cpp, donde la comprobación previa compara inputPath.extension() con las cadenas .ctf y .ang usando operadores sensibles a mayúsculas, y en Algorithms/ConvertHexGridToSquareGrid.cpp, Converter::operator(), que tiene la misma comprobación. Convierte la extensión a minúsculas con StringUtilities::toLower en ambos lugares. Ejecuta la prueba HoldRepro902 en ConvertHexGridToSquareGridTest.cpp: un archivo .ANG debería pasar la comprobación previa y ejecutarse, y un .CTF en mayúsculas debería devolver -44601.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
Convert Hexagonal Grid Data to Square Grid Data (TSL - .ang) (ConvertHexGridToSquareGridFilter) rejects a valid .ang file when the extension is not all lower case. A file named scan.ANG or scan.Ang fails preflight with error -44602, "The file extension '.ANG' was not detected correctly". The same file renamed to scan.ang converts correctly.
- Expected: the filter accepts the extension regardless of case, as the other EBSD readers do.
- Actual: preflight and execute fail with -44602.
- Occurs on develop b51d6c353.
Legacy DREAM3D issue BlueQuartzSoftware/DREAM3D#902 asked for case-insensitive extension checks in every filter that reads files. This filter still has the case-sensitive check.
Steps to Reproduce
- Copy a valid hexagonal-grid
.angfile (for examplesingle/hex_grid.angfromconvert_hex_grid_to_square_grid_test.tar.gz) toprobe.ANG. - Add Convert Hexagonal Grid Data to Square Grid Data (TSL - .ang) to a pipeline.
- Turn off Convert Multiple Files, set Input File to
probe.ANG, set an Output Directory, set Output Prefix toSqr_and set Spacing to 0.05, 0.0403. - Preflight shows error -44602.
- Rename the file to
probe.angand preflight again. It passes, and execute writesSqr_probe.ang.
Cause
Preflight compares std::filesystem::path::extension() with ".ang" and ".ctf" using == and !=, so the comparison is case-sensitive:
ConvertHexGridToSquareGridFilter.cpp#L143-L150
if(inputPath.extension() == ("." + ebsdlib::Ctf::FileExt))
{
return MakePreflightErrorResult(-44601, "Ctf files are not on a hexagonal grid and do not need to be converted");
}
else if(inputPath.extension() != ("." + ebsdlib::Ang::FileExt))
{
return MakePreflightErrorResult(-44602, fmt::format("The file extension '{}' was not detected correctly for file '{}'", inputPath.extension().string(), inputPath.string()));
}
The algorithm has the same case-sensitive comparison before it reads each file:
ConvertHexGridToSquareGrid.cpp#L45-L46
if(inputPath.extension() == ("." + ebsdlib::Ang::FileExt))
{
A side effect: an uppercase .CTF file gets the misleading -44602 message, not the -44601 "Ctf files ... do not need to be converted" message.
Verification Unit Test
Add to src/Plugins/OrientationAnalysis/test/ConvertHexGridToSquareGridTest.cpp. It uses the k_HexToSqrTestFilesDir and k_Spacing constants that are already in that file. This is the test as it was run (it was written as a probe, so its name has the HoldRepro902 prefix):
TEST_CASE("HoldRepro902 ConvertHexGrid accepts uppercase ANG", "[HoldRepro]")
{
UnitTest::LoadPlugins();
const UnitTest::TestFileSentinel sentinel(unit_test::k_TestFilesDir, "convert_hex_grid_to_square_grid_test.tar.gz", k_HexToSqrTestFilesDir);
const fs::path source = fs::path(unit_test::k_TestFilesDir.view()) / k_HexToSqrTestFilesDir / "single/hex_grid.ang";
const fs::path root = fs::path(unit_test::k_BinaryTestOutputDir.view()) / "HoldRepro902Hex";
fs::create_directories(root);
for(const std::string extension : {".ang", ".ANG"})
{
const fs::path input = root / ("probe" + extension);
fs::copy_file(source, input, fs::copy_options::overwrite_existing);
ConvertHexGridToSquareGridFilter filter;
auto args = filter.getDefaultArguments();
args.insertOrAssign(ConvertHexGridToSquareGridFilter::k_MultipleFiles_Key, std::make_any<bool>(false));
args.insertOrAssign(ConvertHexGridToSquareGridFilter::k_InputPath_Key, std::make_any<fs::path>(input));
args.insertOrAssign(ConvertHexGridToSquareGridFilter::k_OutputPath_Key, std::make_any<fs::path>(root / (extension == ".ang" ? "lower" : "upper")));
args.insertOrAssign(ConvertHexGridToSquareGridFilter::k_OutputPrefix_Key, std::make_any<std::string>("Sqr_"));
args.insertOrAssign(ConvertHexGridToSquareGridFilter::k_Spacing_Key, std::make_any<std::vector<float32>>(k_Spacing));
DataStructure ds;
const auto preflight = filter.preflight(ds, args);
WARN(fmt::format("Hex {} preflight valid={}", extension, preflight.outputActions.valid()));
if(preflight.outputActions.invalid())
for(const auto& e : preflight.outputActions.errors())
{
WARN(fmt::format("{}: {}", e.code, e.message));
}
CHECK(preflight.outputActions.valid());
const auto result = filter.execute(ds, args);
if(result.result.invalid())
for(const auto& e : result.result.errors())
{
WARN(fmt::format("Hex {} execute {}: {}", extension, e.code, e.message));
}
CHECK(result.result.valid());
if(result.result.valid())
{
const auto out = root / (extension == ".ang" ? "lower" : "upper") / ("Sqr_probe" + extension);
CHECK(fs::exists(out));
}
}
}
Run only this test:
<build-dir>/bin/OrientationAnalysisUnitTest "HoldRepro902 ConvertHexGrid accepts uppercase ANG"
Failure output on develop b51d6c353 (macOS arm64, ci-macos-arm64 preset). The .ang control passes; .ANG fails:
warning:
Hex .ang preflight valid=true
warning:
Hex .ANG preflight valid=false
warning:
-44602: The file extension '.ANG' was not detected correctly for file '.../test_output/HoldRepro902Hex/probe.ANG'
FAILED:
CHECK( preflight.outputActions.valid() )
with expansion:
false
warning:
Hex .ANG execute -44602: The file extension '.ANG' was not detected correctly for file '.../test_output/HoldRepro902Hex/probe.ANG'
FAILED:
CHECK( result.result.valid() )
with expansion:
false
Proposed Fix
Compare the lower-case extension in both places. StringUtilities::toLower in src/simplnx/Utilities/StringUtilities.hpp already does this, and EbsdToH5EbsdFilter uses it since PR #1749.
In ConvertHexGridToSquareGridFilter.cpp (preflight):
const std::string extension = StringUtilities::toLower(inputPath.extension().string());
if(extension == ("." + ebsdlib::Ctf::FileExt))
{
return MakePreflightErrorResult(-44601, "Ctf files are not on a hexagonal grid and do not need to be converted");
}
else if(extension != ("." + ebsdlib::Ang::FileExt))
{
...
}
In Algorithms/ConvertHexGridToSquareGrid.cpp, Converter::operator(), make the same change. With Convert Multiple Files on, preflight checks only the first generated file, so the algorithm check also matters for the other files. The output file keeps the input file name, so Sqr_probe.ANG is written for probe.ANG.
Notes
EbsdToH5EbsdFilterhad the same problem in preflight, fixed by PR #1749. Its execute check (EbsdToH5Ebsd.cpp#L155-L157) is still case-sensitive. A probe on develop b51d6c353 shows that.ANGpasses preflight and fails at execute with -99512. That item is tracked in #1867 asEbsdToH5EbsdFilter#1. It is not part of this issue.- The file parameter itself (
FileSystemPathParameter) already acceptsprobe.ANG: the -44602 error comes from the filter's own check above.
- Lenguaje dominante
- C++
- Estrellas
- 18
- Forks
- 15
- Merge medio
- 4 d 6 h
- PR fusionados (30 d)
- 24
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de BlueQuartzSoftware/simplnx
-
BUG: Seven ImageProcessing tests never run under ctest because their names contain a semicolonPosiblemente ocupada @joeykleingers la tomó hace 6 días. Abiertobug Testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
BlueQuartzSoftware/simplnx#1898 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
bug Filter
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BlueQuartzSoftware/simplnx#1891 ·
Los mantenedores suelen responder en 4 días
-
DOC: Compute Feature Phases Binary describes a per-Cell output, but writes one value per FeaturePosiblemente ocupada @imikejackson la tomó hace 2 días. Abiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
BlueQuartzSoftware/simplnx#1886 ·
Los mantenedores suelen responder en 4 días
-
bug Filter
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
BlueQuartzSoftware/simplnx#1860 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
BlueQuartzSoftware/simplnx#1847 ·
Los mantenedores suelen responder en 4 días
Todos los issues de BlueQuartzSoftware/simplnx
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
eclipse-score/lifecycle#929 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
colbymchenry/codegraph#3223 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
firefox-devtools/profiler#6436 · 1 comentario ·
Los mantenedores suelen responder en 1 día