Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ find_package(boost_mp11 CONFIG REQUIRED)
find_package(nod CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)

#------------------------------------------------------------------------------
# Find the Image IO libraries
#------------------------------------------------------------------------------
find_package(Stb REQUIRED)
find_package(TIFF REQUIRED)

# -----------------------------------------------------------------------
# Find HDF5 and get the path to the DLL libraries and put that into a
# global property for later install, debugging and packaging
Expand Down Expand Up @@ -266,6 +272,7 @@ target_link_libraries(simplnx
Boost::mp11
nod::nod
spdlog::spdlog
TIFF::TIFF
)

if(UNIX)
Expand Down Expand Up @@ -573,7 +580,13 @@ set(SIMPLNX_HDRS
${SIMPLNX_SOURCE_DIR}/Utilities/MontageUtilities.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/SIMPLConversion.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/IntersectionUtilities.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/NeighborUtilities.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/NeighborUtilities.hpp

${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/IImageIO.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/ImageMetadata.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/ImageIOFactory.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/StbImageIO.hpp
${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/TiffImageIO.hpp

${SIMPLNX_SOURCE_DIR}/Utilities/Math/GeometryMath.hpp
# ${SIMPLNX_SOURCE_DIR}/Utilities/Math/MatrixMath.hpp
Expand Down Expand Up @@ -791,6 +804,10 @@ set(SIMPLNX_SRCS

${SIMPLNX_SOURCE_DIR}/Utilities/Parsing/Text/CsvParser.cpp
${SIMPLNX_SOURCE_DIR}/Utilities/MD5.cpp

${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/ImageIOFactory.cpp
${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/StbImageIO.cpp
${SIMPLNX_SOURCE_DIR}/Utilities/ImageIO/TiffImageIO.cpp
)

# Add Core FilterParameters
Expand Down
1 change: 1 addition & 0 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ message(STATUS "* span-lite (${span-lite_VERSION}) ${span-lite_DIR}")
message(STATUS "* boost_mp11 (${boost_mp11_VERSION}) ${boost_mp11_DIR}")
message(STATUS "* nod (${nod_VERSION}) ${nod_DIR}")
message(STATUS "* reproc++ (${reproc_VERSION}) ${reproc++_DIR}")
message(STATUS "* stb (${stb_VERSION}) ${stb_DIR}")
if(SIMPLNX_USE_LOCAL_EBSD_LIB)
message(STATUS "* EbsdLib: Local repository being used")
else()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ void ConvertImageToDataStoreAsType(itk::Image<PixelT, Dimension>& image, DataSto

const auto* rawBufferPtr = reinterpret_cast<const T*>(pixelContainer->GetBufferPointer());

// pixelContainer->Size() returns the number of pixels, not the number of scalar
// elements. For multi-component pixel types (e.g. itk::Vector<uint8, 3>), the
// underlying scalar buffer contains pixelCount * componentsPerPixel elements.
// Multiply by the component count so std::transform iterates over every scalar.
const std::size_t componentsPerPixel = itk::NumericTraits<PixelT>::GetLength();
const std::size_t totalElements = pixelContainer->Size() * componentsPerPixel;

constexpr auto destMaxV = static_cast<float64>(std::numeric_limits<NewStoreT>::max());
constexpr auto originMaxV = std::numeric_limits<T>::max();
std::transform(rawBufferPtr, rawBufferPtr + pixelContainer->Size(), dataStore.data(), [](auto value) {
std::transform(rawBufferPtr, rawBufferPtr + totalElements, dataStore.data(), [](auto value) {
float64 ratio = static_cast<float64>(value) / static_cast<float64>(originMaxV);
return static_cast<NewStoreT>(ratio * destMaxV);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ std::string ITKImageReaderFilter::humanName() const
//------------------------------------------------------------------------------
std::vector<std::string> ITKImageReaderFilter::defaultTags() const
{
return {className(), "io", "input", "read", "import"};
return {className(), "io", "input", "read", "import", "image", "jpg", "tiff", "bmp", "png"};
}

//------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@
#include <cmath>
#include <filesystem>
#include <iomanip>
#include <sstream>

#include "simplnx/Utilities/SIMPLConversion.hpp"

#include <sstream>

namespace fs = std::filesystem;

using namespace nx::core;
Expand Down
4 changes: 0 additions & 4 deletions src/Plugins/ITKImageProcessing/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND SIMPLNX_DOWNLOAD_TEST_FILES)
file(MAKE_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles/")
endif()
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME fiji_montage.tar.gz SHA512 70139babc838ce3ab1f5adddfddc86dcc51996e614c6c2d757bcb2e59e8ebdc744dac269233494b1ef8d09397aecb4ccca3384f0a91bb017f2cf6309c4ac40fa)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME image_flip_test_images.tar.gz SHA512 4e282a270251133004bf4b979d0d064631b618fc82f503184c602c40d388b725f81faf8e77654d285852acc3217d51534c9a71240be4a87a91dc46da7871e7d2)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME import_image_stack_test.tar.gz SHA512 bec92d655d0d96928f616612d46b52cd51ffa5dbc1d16a64bb79040bbdd3c50f8193350771b177bb64aa68fc0ff7e459745265818c1ea34eb27431426ff15083)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME import_image_stack_test_v2.tar.gz SHA512 b3600c072ecbdb27ed3ed7298dac88708aa94d1eed21e6b0581b772311d1e3c2c6693713026ae512c86729079b41c629067fb1a7df75697d08dbdf2dfad0f553)
download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} ARCHIVE_NAME itk_image_reader_test.tar.gz SHA512 15c42c913df8e0aebfc4196ea96ed5fdc2fab71daacbaf27287d6aee08483acb37f2f38d88af6c549084bae892b07c7aca8537b2511920d18248c8bc18aab92f)
endif()

create_pipeline_tests(PLUGIN_NAME ${PLUGIN_NAME} PIPELINE_LIST ${PREBUILT_PIPELINE_NAMES})
24 changes: 12 additions & 12 deletions src/Plugins/ITKImageProcessing/test/ITKImageReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ using namespace nx::core;

namespace
{
const std::string k_TestDataDirName = "itk_image_reader_test";
const std::string k_TestDataDirName = "itk_image_reader_test_v3";
const fs::path k_TestDataDir = fs::path(unit_test::k_TestFilesDir.view()) / k_TestDataDirName;
const fs::path k_ExemplarFile = k_TestDataDir / "itk_image_reader_test.dream3d";
const fs::path k_ExemplarFile = k_TestDataDir / "itk_image_reader_test_v3.dream3d";
const fs::path k_InputImageFile = k_TestDataDir / "200x200_0.tif";
const std::string k_ImageDataName = "ImageData";
} // namespace

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Read_Basic", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -66,7 +66,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Read_Basic", "[ITKImageProc

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Override_Origin", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -112,7 +112,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Override_Origin", "[ITKImag

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Centering_Origin", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -156,7 +156,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Centering_Origin", "[ITKIma

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Cropping", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

// This block generates every combination of croppingOptions, changeOrigin, and changeSpacing and then the entire test executes for each combination
std::vector<float64> spacing = {2.0, 2.0, 1.0};
Expand Down Expand Up @@ -233,7 +233,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Cropping", "[ITKImageProces

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Override_Spacing", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -279,7 +279,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Override_Spacing", "[ITKIma

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: OriginSpacing_Preprocessed", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -337,7 +337,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: OriginSpacing_Preprocessed"

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: OriginSpacing_Postprocessed", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -396,7 +396,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: OriginSpacing_Postprocessed

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: DataType_Conversion", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -443,7 +443,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: DataType_Conversion", "[ITK

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Interaction_Crop_DataType", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down Expand Up @@ -499,7 +499,7 @@ TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Interaction_Crop_DataType",

TEST_CASE("ITKImageProcessing::ITKImageReaderFilter: Interaction_All", "[ITKImageProcessing][ITKImageReaderFilter]")
{
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test.tar.gz", k_TestDataDirName);
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "itk_image_reader_test_v3.tar.gz", k_TestDataDirName, true, true);

UnitTest::LoadPlugins();
ITKImageReaderFilter filter;
Expand Down
Loading
Loading