-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CMake, refactor CziReader/Writer, add validation
Removed `src/func_readsubblock.h` and `src/func_readsubblock.cpp` from `CMakeLists.txt`. Updated C++ standard from C++11 to C++17 in `CMakeLists.txt`. Replaced raw pointers with `std::vector::data()` in `CziReader::GetMultiChannelScalingTileComposite`. Replaced C-style casts with `static_cast` and `reinterpret_cast` in `CziReader::GetDisplaySettingsFromCzi`. Removed redundant `#include <locale>` from `CziWriter.cpp`. Added `subblock_metadata_xml` parameter to `CziWriter::AddSubBlock` and updated its implementation. Removed commented-out code and unused includes from `CziWriter.h`. Added `CArgsUtils::IsStructure`, `CArgsUtils::TryGetIntValueOfField`, and `CArgsUtils::TryGetStringValueOfField` methods in `argsutils.cpp` and `argsutils.h`. Added validation for the 5th argument in `MexFunction_AddSubBlock_CheckArguments` to ensure it is a 2D or 3D array. Added validation for the 6th argument in `MexFunction_AddSubBlock_CheckArguments` to ensure it is a structure. Added handling for optional `m_index` and `metadata_xml` in `MexFunction_AddSubBlock_Execute`. Removed `func_readsubblock.h`. Added `MexApi::MxIsStruct` and `MexApi::MxGetField` methods in `mexapi.cpp` and `mexapi.h`. Updated `notes.txt` to include examples of using the new `metadata_xml` parameter in `MEXlibCZI`.
- Loading branch information
Showing
12 changed files
with
135 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,19 @@ | ||
#pragma once | ||
|
||
#include "inc_libczi.h" | ||
#include <mutex> | ||
#include <memory> | ||
#include <array> | ||
#include "mexapi.h" | ||
#include <string> | ||
|
||
class CziWriter | ||
{ | ||
private: | ||
std::shared_ptr<libCZI::ICziWriter> writer; | ||
|
||
//std::once_flag flagInfoFromCziMetadata; | ||
|
||
//std::shared_ptr<libCZI::IDisplaySettings> displaySettingsFromCzi; | ||
//libCZI::ScalingInfoEx scalingInfoFromCzi; | ||
|
||
public: | ||
CziWriter() : writer(libCZI::CreateCZIWriter()) | ||
{} | ||
|
||
void Create(const std::string& utf8_filename, bool overwrite_existing); | ||
|
||
void AddSubBlock(const libCZI::AddSubBlockInfoBase& add_sub_block_info_base, const std::shared_ptr<libCZI::IBitmapData>& bitmap_data); | ||
void AddSubBlock(const libCZI::AddSubBlockInfoBase& add_sub_block_info_base, const std::shared_ptr<libCZI::IBitmapData>& bitmap_data, const std::string& subblock_metadata_xml); | ||
void Close(); | ||
/* MexArray* GetInfo(); | ||
std::string GetMetadataXml(); | ||
MexArray* GetMetadataXmlAsMxArray(); | ||
MexArray* GetDefaultDisplaySettingsAsMxArray(); | ||
MexArray* GetSubBlockImage(int sbBlkNo); | ||
MexArray* GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const char* displaySettingsJson); | ||
MexArray* GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom); | ||
MexArray* GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::RgbFloatColor& backgroundColor); | ||
std::array<double, 3> GetScaling(); | ||
MexArray* GetScalingAsMatlabStruct(); | ||
MexArray* ReadSubBlock(int no); | ||
MexArray* GetInfoFromSubBlock(int subBlkHandle); | ||
MexArray* GetMetadataFromSubBlock(int subBlkHandle); | ||
MexArray* GetBitmapFromSubBlock(int subBlkHandle); | ||
bool ReleaseSubBlock(int subBlkHandle)*/; | ||
private: | ||
/* static MexArray* ConvertToMatlabStruct(const libCZI::IDimBounds* bounds); | ||
/// Initializes the members "displaySettingsFromCzi" and "scalingInfoFromCzi". | ||
void InitializeInfoFromCzi(); | ||
std::shared_ptr<libCZI::IDisplaySettings> GetDisplaySettingsFromCzi(); | ||
const libCZI::ScalingInfo& GetScalingInfoFromCzi(); | ||
MexArray* GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::IDisplaySettings* displaySettings); | ||
MexArray* GetMultiChannelScalingTileCompositeAllChannelsDisabled(const libCZI::IntRect& roi, float zoom); | ||
static MexArray* ConvertToMxArray(libCZI::IBitmapData* bitmapData); | ||
static MexArray* ConvertToMatlabStruct(const std::map<int, libCZI::BoundingBoxes>& boundingBoxMap); | ||
static MexArray* ConvertToMatlabStruct(const libCZI::IntRect& rect); | ||
static MexArray* ConvertToMatlabStruct(const libCZI::IntSize& size); | ||
static MexArray* ConvertToMatlabStruct(const libCZI::IDisplaySettings& ds); | ||
static MexArray* ConvertToMatlabStruct(const libCZI::SubBlockInfo& sbBlkInfo); | ||
static void CopyTransposeGray8(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineLength); | ||
static void CopyTransposeGray16(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineLength); | ||
static void CopyTransposeGrayFloat(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineLength); | ||
static void CopyTransposeInterleavedToPlanarBgr24(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineStride, size_t planeStride); | ||
static void CopyTransposeInterleavedToPlanarBgr48(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineStride, size_t planeStride); | ||
*/ | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.