BUG: Avizo uniform export changes sample placement and spacing
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
Línea de trabajo
Los límites incorrectos provienen del cálculo origin + spacing * dimension en generateHeader en src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/WriteAvizoUniformCoordinate.cpp (alrededor de la línea 69). Compáralo con la fórmula del centro de muestra en ImageGeom.cpp. Añade el TEST_CASE proporcionado a src/Plugins/SimplnxCore/test/WriteAvizoUniformCoordinateTest.cpp y ejecuta el selector [AvizoUniformCenters]. Se considera terminado cuando el BoundingBox es 11 15 -3.5 -0.5 4 4 tanto para ASCII como para binario, los ejes singleton mantienen límites iguales y se actualizan las expectativas del exemplar legacy.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
WriteAvizoUniformCoordinateFilter exports ImageGeom outer boundaries as an AmiraMesh sample-center BoundingBox. An AmiraMesh reader therefore changes both sample placement and spacing. A singleton axis also gets unequal bounds.
Reproduced at fe6c4a15e5a5bffef2523f52cec01be33b1e62a9 using Windows x64, MSVC 19.44, Release, in-memory stores.
Expected BoundingBox: 11 15 -3.5 -0.5 4 4. Actual in both encodings: 10 16 -5 1 2 6. X spacing becomes 3 instead of 2, and Y spacing becomes 6 instead of 3.
Steps to Reproduce
- Create an ImageGeom with dimensions
[3,2,1], origin[10,-5,2], and spacing[2,3,4]. - Attach scalar Int32 cell labels
[101,102,103,104,105,106]in X-fastest order, with tuple shape[1,2,3]. - Preflight and execute the writer with units
microns. The test below selects the required encoding(s). - Inspect the coordinate metadata/payload against the expectations above. Preflight and execution both succeed.
Cause
src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/WriteAvizoUniformCoordinate.cpp, line 69 writes origin through origin + spacing * dimension. The AmiraMesh format manual, printed page 198 / PDF page 200 defines BoundingBox using first and last sample centers and equal bounds for a singleton axis. The ImageGeom center calculation uses origin + (index + 0.5) * spacing.
Verification Unit Test
Add this case and its local helpers to src/Plugins/SimplnxCore/test/WriteAvizoUniformCoordinateTest.cpp. It creates its own input and requires no dataset download. The following complete source was compiled and run in an isolated Catch2 harness linked to the matching Release simplnx and SimplnxCore libraries. No production source was changed.
#include "SimplnxCore/Filters/WriteAvizoRectilinearCoordinateFilter.hpp"
#include "SimplnxCore/Filters/WriteAvizoUniformCoordinateFilter.hpp"
#include "simplnx/Common/Bit.hpp"
#include "simplnx/DataStructure/AttributeMatrix.hpp"
#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/Geometry/ImageGeom.hpp"
#include "simplnx/Parameters/FileSystemPathParameter.hpp"
#include "simplnx/UnitTest/UnitTestCommon.hpp"
#include <catch2/catch.hpp>
#include <array>
#include <cstring>
#include <filesystem>
#include <fstream>
#include <iterator>
#include <sstream>
using namespace nx::core;
namespace
{
template <class FilterT>
std::string writeFixture(bool binary, const std::string& name)
{
UnitTest::LoadPlugins();
DataStructure dataStructure;
auto* image = ImageGeom::Create(dataStructure, "Image");
REQUIRE(image != nullptr);
image->setDimensions({3, 2, 1});
image->setOrigin({10.0f, -5.0f, 2.0f});
image->setSpacing({2.0f, 3.0f, 4.0f});
auto* cells = AttributeMatrix::Create(dataStructure, "Cells", {1, 2, 3}, image->getId());
REQUIRE(cells != nullptr);
image->setCellData(*cells);
auto* labels = Int32Array::CreateWithStore<Int32DataStore>(dataStructure, "FeatureIds", {1, 2, 3}, {1}, cells->getId());
REQUIRE(labels != nullptr);
for(usize index = 0; index < 6; ++index)
{
(*labels)[index] = static_cast<int32>(101 + index);
}
UnitTest::CheckArraysInheritTupleDims(dataStructure);
const auto path = std::filesystem::current_path() / name;
FilterT filter;
auto args = filter.getDefaultArguments();
args.insertOrAssign(FilterT::k_OutputFile_Key, std::make_any<FileSystemPathParameter::ValueType>(path));
args.insertOrAssign(FilterT::k_WriteBinaryFile_Key, std::make_any<bool>(binary));
args.insertOrAssign(FilterT::k_GeometryPath_Key, std::make_any<DataPath>(DataPath({"Image"})));
args.insertOrAssign(FilterT::k_FeatureIdsArrayPath_Key, std::make_any<DataPath>(DataPath({"Image", "Cells", "FeatureIds"})));
args.insertOrAssign(FilterT::k_Units_Key, std::make_any<std::string>("microns"));
const auto preflight = filter.preflight(dataStructure, args);
SIMPLNX_RESULT_REQUIRE_VALID(preflight.outputActions);
const auto execution = filter.execute(dataStructure, args);
SIMPLNX_RESULT_REQUIRE_VALID(execution.result);
std::ifstream stream(path, std::ios::binary);
REQUIRE(stream.is_open());
return {std::istreambuf_iterator<char>(stream), std::istreambuf_iterator<char>()};
}
usize payloadOffset(const std::string& contents, const std::string& marker)
{
const auto position = contents.find("\n" + marker);
REQUIRE(position != std::string::npos);
const auto newline = contents.find('\n', position + 1);
REQUIRE(newline != std::string::npos);
return newline + 1;
}
} // namespace
TEST_CASE("Avizo uniform bounding box preserves sample centers", "[AvizoUniformCenters]")
{
for(bool binary : {false, true})
{
CAPTURE(binary);
const auto contents = writeFixture<WriteAvizoUniformCoordinateFilter>(binary, binary ? "uniform_binary.am" : "uniform_ascii.am");
const auto position = contents.find(" BoundingBox ");
REQUIRE(position != std::string::npos);
std::istringstream values(contents.substr(position));
std::string keyword;
values >> keyword;
REQUIRE(keyword == "BoundingBox");
// AmiraMesh bounds are the first and last sample centers, including singleton axes.
const std::array<double, 6> expected = {11.0, 15.0, -3.5, -0.5, 4.0, 4.0};
for(usize component = 0; component < expected.size(); ++component)
{
double actual = 0.0;
REQUIRE(static_cast<bool>(values >> actual));
CAPTURE(component);
CHECK(actual == Approx(expected[component]).margin(1.0e-6));
}
}
}
The executed harness registered AvizoUniformCenters with the Catch2 selector [AvizoUniformCenters] and ran:
ctest --test-dir <AvizoContractRepro-build> -C Release -j 1 -R "^AvizoUniformCenters$" --output-on-failure
For a standard plugin test build, register the same selector if it is not discovered automatically:
add_test(NAME AvizoUniformCenters COMMAND SimplnxCoreUnitTest "[AvizoUniformCenters]" --reporter compact)
Observed failure excerpt:
actual == Approx(expected[component]): 10.0 == Approx(11.0)
actual == Approx(expected[component]): 16.0 == Approx(15.0)
Failed 1 test case, failed 12 assertions.
An independent native control passed for all four writer/encoding combinations: every label, dimension and units string was preserved. Output-overwrite warnings occurred because cases shared their generated filenames; the failures above are numeric assertions, not preflight or file-open failures.
Proposed Fix
In WriteAvizoUniformCoordinate::generateHeader, use origin + 0.5 * spacing for the minimum and origin + (dimension - 0.5) * spacing for the maximum. Cover every axis and preserve equal endpoints when the dimension is one. Update legacy exemplar expectations only after independent coordinate checks pass.
Notes
Fixes belong on a separate source branch. No fix was applied or tested. Actual Avizo application behavior, other platforms and OOC storage were not tested. This defect blocks a proposed faithful-coordinate export comparison using the existing measured Gille LabDCT ROI.
- Lenguaje dominante
- C++
- Estrellas
- 18
- Forks
- 15
- Merge medio
- 3 d 35 min
- PR fusionados (30 d)
- 25
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
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BlueQuartzSoftware/simplnx#1912 ·
Los mantenedores suelen responder en 3 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
BlueQuartzSoftware/simplnx#1906 ·
Los mantenedores suelen responder en 3 días
-
BUG: Compute C-Axis Locations writes a zero vector for a zero quaternionPosiblemente ocupada @jmarquisbq la tomó hace 1 día. Abiertobug Filter
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BlueQuartzSoftware/simplnx#1891 · 1 asignado ·
Los mantenedores suelen responder en 3 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 3 días
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
BlueQuartzSoftware/simplnx#1847 ·
Los mantenedores suelen responder en 3 días
Todos los issues de BlueQuartzSoftware/simplnx
Issues similares
-
rombios: CMD needs to be a WORDAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
new issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
llvm/llvm-project#240065 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 2 días
-
ai_p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ClickHouse/ClickHouse#130006 ·
Los mantenedores suelen responder en 1 día
-
RebuildGeom rebuilds vertex buffers needlesslyPosiblemente ocupada @trish-sl la tomó hoy. Abiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
secondlife/viewer#6653 ·
Los mantenedores suelen responder en 1 día