-
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.
Add new functions and update CMakeLists.txt
Updated CMakeLists.txt to include new source files for functions: func_getmultichannelscalingtilecomposite, func_getinfo, func_getmetadataxml, and func_getscaling. Adjusted lib_VERSION_EXT for formatting consistency. In mexFunctions.cpp, added new include directives and updated funcItems array with new functions. Added implementations for new functions in respective .cpp and .h files.
- Loading branch information
Showing
10 changed files
with
201 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "func_getinfo.h" | ||
#include <memory> | ||
#include "../implementation/argsutils.h" | ||
#include "../implementation/utils.h" | ||
|
||
using namespace std; | ||
|
||
void MexFunction_GetInfo_CheckArguments(MatlabArgs* args) | ||
{ | ||
if (args->nrhs < 2) | ||
{ | ||
throw invalid_argument("not enough arguments"); | ||
} | ||
|
||
if (!CArgsUtils::IsNumericArrayOfMinSize(args->prhs[1], 1, args->app_functions)) | ||
{ | ||
throw invalid_argument("2nd argument must be an integer"); | ||
} | ||
} | ||
|
||
void MexFunction_GetInfo_Execute(MatlabArgs* args) | ||
{ | ||
int id; | ||
bool b = CArgsUtils::TryGetInt32(args->prhs[1], &id, args->app_functions); | ||
const std::shared_ptr<CziReader> reader = ::Utils::GetReaderOrThrow(id); | ||
|
||
auto* info = reader->GetInfo(args->app_functions); | ||
args->plhs[0] = info; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include "../mexFunctions.h" | ||
|
||
void MexFunction_GetInfo_CheckArguments(MatlabArgs* args); | ||
void MexFunction_GetInfo_Execute(MatlabArgs* args); |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "func_getmetadataxml.h" | ||
#include <memory> | ||
#include "../implementation/argsutils.h" | ||
#include "../implementation/utils.h" | ||
|
||
using namespace std; | ||
|
||
// How to parse an XML-string with MATLAB -> http://undocumentedmatlab.com/articles/parsing-xml-strings | ||
|
||
void MexFunction_GetMetadataXml_CheckArguments(MatlabArgs* args) | ||
{ | ||
if (args->nrhs < 2) | ||
{ | ||
throw invalid_argument("not enough arguments"); | ||
} | ||
|
||
if (!CArgsUtils::IsNumericArrayOfMinSize(args->prhs[1], 1, args->app_functions)) | ||
{ | ||
throw invalid_argument("2nd argument must be an integer"); | ||
} | ||
} | ||
|
||
void MexFunction_GetMetadataXml_Execute(MatlabArgs* args) | ||
{ | ||
int id; | ||
bool b = CArgsUtils::TryGetInt32(args->prhs[1], &id, args->app_functions); | ||
std::shared_ptr<CziReader> reader = ::Utils::GetReaderOrThrow(id); | ||
auto* m = reader->GetMetadataXmlAsMxArray(args->app_functions); | ||
args->plhs[0] = m; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include "../mexFunctions.h" | ||
|
||
void MexFunction_GetMetadataXml_CheckArguments(MatlabArgs* args); | ||
void MexFunction_GetMetadataXml_Execute(MatlabArgs* args); |
68 changes: 68 additions & 0 deletions
68
lib/src/functions/func_getmultichannelscalingtilecomposite.cpp
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "func_getmultichannelscalingtilecomposite.h" | ||
#include "../implementation/CziReaderManager.h" | ||
#include <vector> | ||
#include <memory> | ||
#include "../implementation/argsutils.h" | ||
#include "../implementation/utils.h" | ||
|
||
using namespace std; | ||
using namespace libCZI; | ||
|
||
void MexFunction_GetMultiChannelScalingTileComposite_CheckArguments(MatlabArgs* args) | ||
{ | ||
// arguments: | ||
// (1) handle | ||
// (2) ROI -> array of >=4 numbers | ||
// (3) plane-coordinate | ||
// (4) zoom (number) | ||
// (5) (optional) display-settings | ||
if (args->nrhs < 5) | ||
{ | ||
throw invalid_argument("not enough arguments"); | ||
} | ||
|
||
if (!CArgsUtils::IsNumericArrayOfMinSize(args->prhs[1], 1, args->app_functions)) | ||
{ | ||
throw invalid_argument("1st argument must be an integer"); | ||
} | ||
|
||
if (!CArgsUtils::IsNumericArrayOfMinSize(args->prhs[2], 4, args->app_functions)) | ||
{ | ||
throw invalid_argument("2nd argument must be a ROI"); | ||
} | ||
|
||
if (!CArgsUtils::TryGetDimCoordinate(args->prhs[3], nullptr, args->app_functions)) | ||
{ | ||
throw invalid_argument("3nd argument must be a string (specifying a coordinate)"); | ||
} | ||
|
||
if (!CArgsUtils::TryGetSingle(args->prhs[4], nullptr, args->app_functions)) | ||
{ | ||
throw invalid_argument("4th argument must be a number"); | ||
} | ||
} | ||
|
||
void MexFunction_GetMultiChannelScalingTileComposite_Execute(MatlabArgs* args) | ||
{ | ||
int id; | ||
bool b = CArgsUtils::TryGetInt32(args->prhs[1], &id, args->app_functions); | ||
|
||
std::shared_ptr<CziReader> reader = ::Utils::GetReaderOrThrow(id); | ||
IntRect rect; | ||
b = CArgsUtils::TryGetIntRect(args->prhs[2], &rect, args->app_functions); | ||
|
||
CDimCoordinate coord; | ||
b = CArgsUtils::TryGetDimCoordinate(args->prhs[3], &coord, args->app_functions); | ||
|
||
float zoom; | ||
b = CArgsUtils::TryGetSingle(args->prhs[4], &zoom, args->app_functions); | ||
|
||
auto* out = reader->GetMultiChannelScalingTileComposite( | ||
rect, | ||
&coord, | ||
(float)zoom, | ||
(const char*)nullptr/*displaySettingsString*/, | ||
args->app_functions); | ||
|
||
args->plhs[0] = out; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include "../mexFunctions.h" | ||
|
||
void MexFunction_GetMultiChannelScalingTileComposite_CheckArguments(MatlabArgs* args); | ||
void MexFunction_GetMultiChannelScalingTileComposite_Execute(MatlabArgs* args); |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "func_getscaling.h" | ||
#include <memory> | ||
#include "../implementation/argsutils.h" | ||
#include "../implementation/utils.h" | ||
|
||
using namespace std; | ||
|
||
void MexFunction_GetScaling_CheckArguments(MatlabArgs* args) | ||
{ | ||
if (args->nrhs < 2) | ||
{ | ||
throw invalid_argument("not enough arguments"); | ||
} | ||
|
||
if (!CArgsUtils::IsNumericArrayOfMinSize(args->prhs[1], 1, args->app_functions)) | ||
{ | ||
throw invalid_argument("2nd argument must be an integer"); | ||
} | ||
} | ||
|
||
void MexFunction_GetScaling_Execute(MatlabArgs* args) | ||
{ | ||
int id; | ||
const bool b = CArgsUtils::TryGetInt32(args->prhs[1], &id, args->app_functions); | ||
if (!b) | ||
{ | ||
throw invalid_argument("2nd argument must be an integer"); | ||
} | ||
|
||
std::shared_ptr<CziReader> reader = ::Utils::GetReaderOrThrow(id); | ||
auto* m = reader->GetScalingAsMatlabStruct(args->app_functions); | ||
args->plhs[0] = m; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include "../mexFunctions.h" | ||
|
||
void MexFunction_GetScaling_CheckArguments(MatlabArgs* args); | ||
void MexFunction_GetScaling_Execute(MatlabArgs* args); |
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