InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.42k stars 664 forks source link

`itkFEMElement2DC0LinearQuadrilateralStressTestFEMObjectReader` has hard-coded I/O filenames #4417

Open jhlegarreta opened 9 months ago

jhlegarreta commented 9 months ago

Description

The itkFEMElement2DC0LinearQuadrilateralStressTestFEMObjectReader test in the FEM module has hard-coded I/O filenames. Additionally, it is not listed in the FEM module's test directory CMakeLists.txt file, so even if the module and testing are turned ON when configuring ITK, the build will succeed.

Steps to Reproduce

  1. Check-out ITK.
  2. Turn on the FEM module and building the tests when configuring.
  3. Build.
  4. Run ctest -V -R itkFEMElement2DC0LinearQuadrilateralStressTestFEMObjectReader -C Debug: no test will be found.

Expected behavior

No hard-coded paths should exist: the test should have its I/O arguments specified in the corresponding CMakeLists.txt entry.

Actual behavior

The itkFEMElement2DC0LinearQuadrilateralStressTestFEMObjectReader test in the FEM module has hard-coded I/O filenames. Additionally, it is not listed in the FEM module's test directory CMakeLists.txt file, so the test is not run even if turning ON the FEMmodule and building tests; it will fail if doing so, and adding an entry to CMakeLists.txt since the I/O filenames are hard-coded.

Reproducibility

100%.

Versions

ITK master.

Environment

Any

Additional Information

Its Trial.meta input file is not found on the current ITK source code tree; SpatialObjects.meta is found at https://github.com/InsightSoftwareConsortium/ITK/blob/5cf4a7226f1be5133f96fe7fcb49ba1fc367d525/Testing/Data/Input/SpatialObjects.meta.cid.

The test (including the hard-coded paths) was added by commit 23f10a9 (Kent Williams authored and @hjmjohnson committed on Jul 15, 2011). It does not look like Trial.meta has ever been committed.

jhlegarreta commented 9 months ago

Slightly related: itkFEMElementTest does also have some hard-coded paths: https://github.com/InsightSoftwareConsortium/ITK/blob/5cf4a7226f1be5133f96fe7fcb49ba1fc367d525/Modules/Numerics/FEM/test/itkFEMElementTest.cxx#L37 and https://github.com/InsightSoftwareConsortium/ITK/blob/5cf4a7226f1be5133f96fe7fcb49ba1fc367d525/Modules/Numerics/FEM/test/itkFEMElementTest.cxx#L40

These should be given as parameters in the CMakeLists.txt file.

jhlegarreta commented 2 months ago

Looks like some of the missing data files do not exist in ITK any more, but this repository seems to contain an old version of ITK that does have that data: https://github.com/kiranhs/ITKv4FEM-Kiran

in folder Testing/Code/Numerics/FEM/Data.

However, it looks like the data format was changed at some point, and seems like the previous fem files were transitioned to the meta format. There is still some files that are in the above repository that are in the old format that would hlps in fixing this issue. @thewtex @dzenanz @hjmjohnson @blowekamp do you know how they were transitioned and whether the same principle should apply to the files that should be brought in order to fix this? Can you provide me with the tools to do the transition, please?

Applies to https://github.com/InsightSoftwareConsortium/ITK/blob/009b0a849aed8236be63f33161d9803dc47fb122/Modules/Numerics/FEM/test/itkFEMElement2DC0LinearLineStressItpackTest.cxx

as well.

thewtex commented 2 months ago

@jhlegarreta thanks for taking a look. I do not recall any details on that transition.

dzenanz commented 2 months ago

I don't remember anything about it either. And I am not sure that anyone uses FEM module, so I would advise against investing much effort into its maintenance.