Volume Cartographer 2.28.0
core.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <cstddef>
6
7#include <opencv2/core.hpp>
8#include <smgl/Node.hpp>
9
11#include "vc/core/io/ImageIO.hpp"
12#include "vc/core/io/MeshIO.hpp"
21
22namespace volcart
23{
24
30class LoadVolumePkgNode : public smgl::Node
31{
32private:
34 filesystem::path path_{};
37
38public:
40 smgl::InputPort<filesystem::path> path;
42 smgl::OutputPort<VolumePkg::Pointer> volpkg;
43
46
47private:
49 auto serialize_(bool /*useCache*/, const filesystem::path& /*cacheDir*/)
50 -> smgl::Metadata override;
51
54 const smgl::Metadata& meta,
55 const filesystem::path& /*cacheDir*/) override;
56};
57
63class VolumePkgPropertiesNode : public smgl::Node
64{
65private:
68
69public:
71 smgl::InputPort<VolumePkg::Pointer> volpkg;
73 smgl::OutputPort<std::string> name;
75 smgl::OutputPort<int> version;
77 smgl::OutputPort<double> materialThickness;
78
81};
82
88class VolumeSelectorNode : public smgl::Node
89{
90private:
97
98public:
100 smgl::InputPort<VolumePkg::Pointer> volpkg;
102 smgl::InputPort<Volume::Identifier> id;
104 smgl::OutputPort<Volume::Pointer> volume;
105
108
109private:
111 auto serialize_(bool /*useCache*/, const filesystem::path& /*cacheDir*/)
112 -> smgl::Metadata override;
113
116 const smgl::Metadata& meta,
117 const filesystem::path& /*cacheDir*/) override;
118};
119
125class VolumePropertiesNode : public smgl::Node
126{
127private:
131 std::size_t cacheMem_{2'000'000'000};
132
133public:
135 smgl::InputPort<Volume::Pointer> volumeIn;
137 smgl::InputPort<std::size_t> cacheMemory;
138
140 smgl::OutputPort<Volume::Bounds> bounds;
142 smgl::OutputPort<double> voxelSize;
149 smgl::OutputPort<Volume::Pointer> volumeOut;
150
153
154private:
156 auto serialize_(bool /*useCache*/, const filesystem::path& /*cacheDir*/)
157 -> smgl::Metadata override;
158
161 const smgl::Metadata& meta,
162 const filesystem::path& /*cacheDir*/) override;
163};
164
170class SegmentationSelectorNode : public smgl::Node
171{
172private:
179
180public:
182 smgl::InputPort<VolumePkg::Pointer> volpkg;
184 smgl::InputPort<Segmentation::Identifier> id;
186 smgl::OutputPort<Segmentation::Pointer> segmentation;
187
190
191private:
193 auto serialize_(bool /*useCache*/, const filesystem::path& /*cacheDir*/)
194 -> smgl::Metadata override;
195
198 const smgl::Metadata& meta,
199 const filesystem::path& /*cacheDir*/) override;
200};
201
207class SegmentationPropertiesNode : public smgl::Node
208{
211
212public:
214 smgl::InputPort<Segmentation::Pointer> segmentation;
216 smgl::OutputPort<Segmentation::PointSet> pointSet;
217
220};
221
228class MeshPropertiesNode : public smgl::Node
229{
230private:
232 ITKMesh::Pointer mesh_{nullptr};
233
234public:
236 smgl::InputPort<ITKMesh::Pointer> mesh{&mesh_};
238 smgl::OutputPort<std::size_t> numVertices;
240 smgl::OutputPort<std::size_t> numFaces;
241
244};
245
252class LoadMeshNode : public smgl::Node
253{
254private:
256 filesystem::path path_{};
258 bool cacheArgs_{false};
261
262public:
264 smgl::InputPort<filesystem::path> path;
266 smgl::InputPort<bool> cacheArgs;
268 smgl::OutputPort<ITKMesh::Pointer> mesh;
270 smgl::OutputPort<UVMap::Pointer> uvMap;
272 smgl::OutputPort<cv::Mat> texture;
273
276
277private:
279 auto serialize_(bool useCache, const filesystem::path& cacheDir)
280 -> smgl::Metadata override;
281
284 const smgl::Metadata& meta,
285 const filesystem::path& /*cacheDir*/) override;
286};
287
294class WriteMeshNode : public smgl::Node
295{
296private:
298 filesystem::path path_{};
300 ITKMesh::Pointer mesh_{nullptr};
304 cv::Mat texture_{};
306 bool cacheArgs_{false};
307
308public:
310 smgl::InputPort<filesystem::path> path;
312 smgl::InputPort<ITKMesh::Pointer> mesh;
314 smgl::InputPort<UVMap::Pointer> uvMap;
316 smgl::InputPort<cv::Mat> texture;
318 smgl::InputPort<bool> cacheArgs;
319
322
323private:
325 auto serialize_(bool useCache, const filesystem::path& cacheDir)
326 -> smgl::Metadata override;
327
330 const smgl::Metadata& meta,
331 const filesystem::path& /*cacheDir*/) override;
332};
333
343class RotateUVMapNode : public smgl::Node
344{
345private:
349 double theta_{0};
352
353public:
355 smgl::InputPort<UVMap::Pointer> uvMapIn;
357 smgl::InputPort<double> theta;
359 smgl::OutputPort<UVMap::Pointer> uvMapOut;
360
363
364private:
366 auto serialize_(bool useCache, const filesystem::path& cacheDir)
367 -> smgl::Metadata override;
368
371 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
372};
373
381class FlipUVMapNode : public smgl::Node
382{
383private:
387 UVMap::FlipAxis axis_{UVMap::FlipAxis::Vertical};
390
391public:
395 smgl::InputPort<UVMap::Pointer> uvMapIn;
397 smgl::InputPort<FlipAxis> flipAxis;
399 smgl::OutputPort<UVMap::Pointer> uvMapOut;
400
403
404private:
406 auto serialize_(bool useCache, const filesystem::path& cacheDir)
407 -> smgl::Metadata override;
408
411 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
412};
413
422class AlignUVMapToAxisNode : public smgl::Node
423{
424private:
428 ITKMesh::Pointer mesh_;
430 UVMap::AlignmentAxis axis_{UVMap::AlignmentAxis::ZPos};
433
434public:
436 smgl::InputPort<UVMap::Pointer> uvMapIn;
438 smgl::InputPort<ITKMesh::Pointer> mesh;
440 smgl::InputPort<UVMap::AlignmentAxis> axis;
442 smgl::OutputPort<UVMap::Pointer> uvMapOut;
443
446
447private:
449 auto serialize_(bool useCache, const filesystem::path& cacheDir)
450 -> smgl::Metadata override;
451
454 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
455};
456
463class PlotUVMapNode : public smgl::Node
464{
465private:
469 ITKMesh::Pointer uvMesh_;
471 cv::Mat plot_;
472
473public:
475 smgl::InputPort<UVMap::Pointer> uvMap;
477 smgl::InputPort<ITKMesh::Pointer> uvMesh;
479 smgl::OutputPort<cv::Mat> plot;
480
483
484private:
486 auto serialize_(bool useCache, const filesystem::path& cacheDir)
487 -> smgl::Metadata override;
488
491 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
492};
493
500class LoadImageNode : public smgl::Node
501{
502private:
504 filesystem::path path_{};
506 bool cacheArgs_{false};
508 cv::Mat image_{};
509
510public:
512 smgl::InputPort<filesystem::path> path;
514 smgl::InputPort<bool> cacheArgs;
516 smgl::OutputPort<cv::Mat> image;
517
520
521private:
523 auto serialize_(bool useCache, const filesystem::path& cacheDir)
524 -> smgl::Metadata override;
525
528 const smgl::Metadata& meta,
529 const filesystem::path& /*cacheDir*/) override;
530};
531
538class WriteImageNode : public smgl::Node
539{
540private:
542 filesystem::path path_{};
544 cv::Mat image_{};
548 bool cacheArgs_{false};
549
550public:
552 smgl::InputPort<filesystem::path> path;
554 smgl::InputPort<cv::Mat> image;
556 smgl::InputPort<WriteImageOpts> options;
558 smgl::InputPort<bool> cacheArgs;
559
562
563private:
565 auto serialize_(bool useCache, const filesystem::path& cacheDir)
566 -> smgl::Metadata override;
567
570 const smgl::Metadata& meta,
571 const filesystem::path& /*cacheDir*/) override;
572};
573
580class WriteImageSequenceNode : public smgl::Node
581{
582private:
584 using ImageSequence = std::vector<cv::Mat>;
586 filesystem::path path_{};
592 bool eagerMode_{false};
594 bool cacheArgs_{false};
595
596public:
598 smgl::InputPort<filesystem::path> path;
600 smgl::InputPort<ImageSequence> images;
602 smgl::InputPort<WriteImageOpts> options;
611 smgl::InputPort<bool> eagerMode;
613 smgl::InputPort<bool> cacheArgs;
614
617
630 std::size_t idx, std::size_t count, const cv::Mat& image) const;
631
632private:
634 auto serialize_(bool useCache, const filesystem::path& cacheDir)
635 -> smgl::Metadata override;
636
639 const smgl::Metadata& meta,
640 const filesystem::path& /*cacheDir*/) override;
641};
642
649class LoadPPMNode : public smgl::Node
650{
651private:
653 filesystem::path path_{};
655 bool cacheArgs_{false};
658
659public:
661 smgl::InputPort<filesystem::path> path;
663 smgl::InputPort<bool> cacheArgs;
665 smgl::OutputPort<PerPixelMap::Pointer> ppm;
666
669
670private:
672 auto serialize_(bool useCache, const filesystem::path& cacheDir)
673 -> smgl::Metadata override;
674
677 const smgl::Metadata& meta,
678 const filesystem::path& /*cacheDir*/) override;
679};
680
687class WritePPMNode : public smgl::Node
688{
689private:
691 filesystem::path path_{};
695 bool cacheArgs_{false};
696
697public:
699 smgl::InputPort<filesystem::path> path;
701 smgl::InputPort<PerPixelMap::Pointer> ppm;
703 smgl::InputPort<bool> cacheArgs;
704
707
708private:
710 auto serialize_(bool useCache, const filesystem::path& cacheDir)
711 -> smgl::Metadata override;
712
715 const smgl::Metadata& meta,
716 const filesystem::path& /*cacheDir*/) override;
717};
718
723class PPMPropertiesNode : public smgl::Node
724{
725private:
728
729public:
731 smgl::InputPort<PerPixelMap::Pointer> ppm;
737 smgl::OutputPort<cv::Mat> mask;
739 smgl::OutputPort<cv::Mat> cellMap;
740
743};
744
752class LoadVolumetricMaskNode : public smgl::Node
753{
754private:
756 filesystem::path path_{};
758 bool cacheArgs_{false};
761
762public:
764 smgl::InputPort<filesystem::path> path;
766 smgl::InputPort<bool> cacheArgs;
768 smgl::OutputPort<VolumetricMask::Pointer> volumetricMask;
769
772
773private:
775 auto serialize_(bool useCache, const filesystem::path& cacheDir)
776 -> smgl::Metadata override;
777
780 const smgl::Metadata& meta,
781 const filesystem::path& /*cacheDir*/) override;
782};
783
790class LoadTransformNode : public smgl::Node
791{
792private:
794 filesystem::path path_{};
796 bool cacheArgs_{false};
799
800public:
802 smgl::InputPort<filesystem::path> path;
804 smgl::InputPort<bool> cacheArgs;
806 smgl::OutputPort<Transform3D::Pointer> transform;
807
810
811private:
813 auto serialize_(bool useCache, const filesystem::path& cacheDir)
814 -> smgl::Metadata override;
815
818 const smgl::Metadata& meta,
819 const filesystem::path& /*cacheDir*/) override;
820};
821
829class TransformSelectorNode : public smgl::Node
830{
831private:
838
839public:
841 smgl::InputPort<VolumePkg::Pointer> volpkg;
843 smgl::InputPort<Transform3D::Identifier> id;
845 smgl::OutputPort<Transform3D::Pointer> transform;
846
849
850private:
852 auto serialize_(bool /*useCache*/, const filesystem::path& /*cacheDir*/)
853 -> smgl::Metadata override;
854
857 const smgl::Metadata& meta,
858 const filesystem::path& /*cacheDir*/) override;
859};
860
869class InvertTransformNode : public smgl::Node
870{
871private:
876
877public:
879 smgl::InputPort<Transform3D::Pointer> input;
881 smgl::OutputPort<Transform3D::Pointer> output;
882
885
886private:
888 auto serialize_(bool useCache, const filesystem::path& cacheDir)
889 -> smgl::Metadata override;
890
893 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
894};
895
902template <class T>
903class ApplyTransformNode : public smgl::Node
904{
905protected:
912
913public:
915 smgl::InputPort<T> input{&input_};
916 smgl::InputPort<Transform3D::Pointer> transform{&tfm_};
917 smgl::OutputPort<T> output{&output_};
918
920 ApplyTransformNode() : Node{true}
921 {
922 registerInputPort("input", input);
923 registerInputPort("transform", transform);
924 registerOutputPort("output", output);
925
926 compute = [&]() {
927 if (tfm_) {
929 }
930 };
931 }
932
933protected:
935 auto serialize_(bool useCache, const filesystem::path& cacheDir)
936 -> smgl::Metadata override
937 {
938 smgl::Metadata meta;
939 if (useCache and tfm_) {
940 Transform3D::Save(cacheDir / "transform.json", tfm_);
941 meta["transform"] = "transform.json";
942 }
943 return meta;
944 }
945
948 const smgl::Metadata& meta, const filesystem::path& cacheDir) override
949 {
950 if (meta.contains("transform")) {
951 auto tfmFile = meta["transform"].get<std::string>();
952 tfm_ = Transform3D::Load(cacheDir / tfmFile);
953 }
954 }
955};
956
962class TransformMeshNode : public ApplyTransformNode<ITKMesh::Pointer>
963{
964private:
967
969 auto serialize_(bool useCache, const filesystem::path& cacheDir)
970 -> smgl::Metadata override;
971
974 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
975};
976
982class TransformPPMNode : public ApplyTransformNode<PerPixelMap::Pointer>
983{
984private:
987
989 auto serialize_(bool useCache, const filesystem::path& cacheDir)
990 -> smgl::Metadata override;
991
994 const smgl::Metadata& meta, const filesystem::path& cacheDir) override;
995};
996
997} // namespace volcart
Rotate a UVMap to align a specified volume axis to the -V direction of UV space.
Definition: core.hpp:423
UVMap::Pointer uvMapOut_
Definition: core.hpp:432
smgl::InputPort< UVMap::AlignmentAxis > axis
Volume axis to use for alignment.
Definition: core.hpp:440
UVMap::Pointer uvMapIn_
Definition: core.hpp:426
smgl::InputPort< ITKMesh::Pointer > mesh
Input mesh, used to orient in volume space.
Definition: core.hpp:438
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::OutputPort< UVMap::Pointer > uvMapOut
Output UVMap.
Definition: core.hpp:442
smgl::InputPort< UVMap::Pointer > uvMapIn
Input UVMap.
Definition: core.hpp:436
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
ITKMesh::Pointer mesh_
Definition: core.hpp:428
UVMap::AlignmentAxis axis_
Definition: core.hpp:430
Template node for applying 3D transforms to objects.
Definition: core.hpp:904
Transform3D::Pointer tfm_
Definition: core.hpp:909
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
Definition: core.hpp:935
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
Definition: core.hpp:947
smgl::InputPort< T > input
Input path.
Definition: core.hpp:915
Flip a UVMap across one or both of its axes.
Definition: core.hpp:382
smgl::InputPort< FlipAxis > flipAxis
Flip axis.
Definition: core.hpp:397
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
UVMap::Pointer uvMapOut_
Definition: core.hpp:389
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
smgl::OutputPort< UVMap::Pointer > uvMapOut
Output UVMap.
Definition: core.hpp:399
smgl::InputPort< UVMap::Pointer > uvMapIn
Input UVMap.
Definition: core.hpp:395
UVMap::Pointer uvMapIn_
Definition: core.hpp:385
UVMap::FlipAxis axis_
Definition: core.hpp:387
Return the inverted transform.
Definition: core.hpp:870
Transform3D::Pointer input_
Definition: core.hpp:873
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
smgl::InputPort< Transform3D::Pointer > input
Input transform.
Definition: core.hpp:879
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
Transform3D::Pointer output_
Definition: core.hpp:875
smgl::OutputPort< Transform3D::Pointer > output
Output transform.
Definition: core.hpp:881
Read an image from the specified path.
Definition: core.hpp:501
smgl::InputPort< bool > cacheArgs
Include the loaded file in the graph cache.
Definition: core.hpp:514
smgl::InputPort< filesystem::path > path
Input path.
Definition: core.hpp:512
smgl::OutputPort< cv::Mat > image
Loaded image.
Definition: core.hpp:516
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
filesystem::path path_
Definition: core.hpp:504
Read a mesh from a file.
Definition: core.hpp:253
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::OutputPort< cv::Mat > texture
Loaded texture image.
Definition: core.hpp:272
MeshReaderResult loaded_
Definition: core.hpp:260
filesystem::path path_
Definition: core.hpp:256
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::InputPort< bool > cacheArgs
Include the loaded file in the graph cache.
Definition: core.hpp:266
smgl::OutputPort< ITKMesh::Pointer > mesh
Loaded mesh.
Definition: core.hpp:268
smgl::OutputPort< UVMap::Pointer > uvMap
Loaded UV map.
Definition: core.hpp:270
smgl::InputPort< filesystem::path > path
Input path.
Definition: core.hpp:264
Read a PerPixelMap from disk.
Definition: core.hpp:650
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::OutputPort< PerPixelMap::Pointer > ppm
Loaded PerPixelMap.
Definition: core.hpp:665
smgl::InputPort< filesystem::path > path
Input path.
Definition: core.hpp:661
smgl::InputPort< bool > cacheArgs
Include the loaded file in the graph cache.
Definition: core.hpp:663
PerPixelMap::Pointer ppm_
Definition: core.hpp:657
filesystem::path path_
Definition: core.hpp:653
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
Load a transform from a JSON file.
Definition: core.hpp:791
Transform3D::Pointer tfm_
Definition: core.hpp:798
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::OutputPort< Transform3D::Pointer > transform
Loaded transform.
Definition: core.hpp:806
filesystem::path path_
Definition: core.hpp:794
smgl::InputPort< bool > cacheArgs
Include the loaded file in the graph cache.
Definition: core.hpp:804
smgl::InputPort< filesystem::path > path
Input path.
Definition: core.hpp:802
Load a VolumePkg from disk.
Definition: core.hpp:31
auto serialize_(bool, const filesystem::path &) -> smgl::Metadata override
smgl::OutputPort< VolumePkg::Pointer > volpkg
Loaded VolPkg.
Definition: core.hpp:42
VolumePkg::Pointer vpkg_
Definition: core.hpp:36
filesystem::path path_
Definition: core.hpp:34
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::InputPort< filesystem::path > path
VolPkg path.
Definition: core.hpp:40
Load a VolumetricMask from a .vcps file.
Definition: core.hpp:753
smgl::InputPort< bool > cacheArgs
Include the loaded file in the graph cache.
Definition: core.hpp:766
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
VolumetricMask::Pointer mask_
Definition: core.hpp:760
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::OutputPort< VolumetricMask::Pointer > volumetricMask
Loaded VolumetricMask.
Definition: core.hpp:768
filesystem::path path_
Definition: core.hpp:756
smgl::InputPort< filesystem::path > path
Input path.
Definition: core.hpp:764
Retrieve Mesh properties (e.g. number of vertices, number of faces, etc.)
Definition: core.hpp:229
smgl::OutputPort< std::size_t > numVertices
Number of vertices in the mesh.
Definition: core.hpp:238
smgl::InputPort< ITKMesh::Pointer > mesh
Input mesh.
Definition: core.hpp:236
smgl::OutputPort< std::size_t > numFaces
Number of faces in the mesh.
Definition: core.hpp:240
ITKMesh::Pointer mesh_
Definition: core.hpp:232
Retrieve PerPixelMap properties (e.g. mask, cell map, etc.)
Definition: core.hpp:724
smgl::OutputPort< cv::Mat > mask
Get the pixel mask.
Definition: core.hpp:737
PerPixelMap::Pointer ppm_
Definition: core.hpp:727
smgl::OutputPort< cv::Mat > cellMap
Get the cell map image.
Definition: core.hpp:739
smgl::InputPort< PerPixelMap::Pointer > ppm
Input PerPixelMap.
Definition: core.hpp:731
std::shared_ptr< PerPixelMap > Pointer
Definition: PerPixelMap.hpp:84
Plot the UV points on an image.
Definition: core.hpp:464
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::InputPort< UVMap::Pointer > uvMap
Input UVMap.
Definition: core.hpp:475
UVMap::Pointer uvMap_
Definition: core.hpp:467
smgl::OutputPort< cv::Mat > plot
Plot image.
Definition: core.hpp:479
smgl::InputPort< ITKMesh::Pointer > uvMesh
Input mesh.
Definition: core.hpp:477
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
ITKMesh::Pointer uvMesh_
Definition: core.hpp:469
Rotate a UVMap by a multiple of 90 degrees.
Definition: core.hpp:344
smgl::InputPort< UVMap::Pointer > uvMapIn
Input UVMap.
Definition: core.hpp:355
smgl::OutputPort< UVMap::Pointer > uvMapOut
Output UVMap.
Definition: core.hpp:359
smgl::InputPort< double > theta
Rotation angle, in degrees.
Definition: core.hpp:357
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
UVMap::Pointer uvMapIn_
Definition: core.hpp:347
UVMap::Pointer uvMapOut_
Definition: core.hpp:351
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
Retrieve Segmentation properties (e.g. pointset)
Definition: core.hpp:208
smgl::OutputPort< Segmentation::PointSet > pointSet
Load the associated PointSet from the Segmentation file.
Definition: core.hpp:216
smgl::InputPort< Segmentation::Pointer > segmentation
Input segmentation.
Definition: core.hpp:214
Segmentation::Pointer seg_
Definition: core.hpp:210
Get a Segmentation by uuid.
Definition: core.hpp:171
smgl::InputPort< Segmentation::Identifier > id
Segmentation UUID.
Definition: core.hpp:184
VolumePkg::Pointer vpkg_
Definition: core.hpp:174
Segmentation::Pointer seg_
Definition: core.hpp:178
auto serialize_(bool, const filesystem::path &) -> smgl::Metadata override
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::InputPort< VolumePkg::Pointer > volpkg
Input VolumePkg.
Definition: core.hpp:182
smgl::OutputPort< Segmentation::Pointer > segmentation
Segmentation.
Definition: core.hpp:186
Segmentation::Identifier id_
Definition: core.hpp:176
std::shared_ptr< Segmentation > Pointer
std::shared_ptr< Transform3D > Pointer
Definition: Transforms.hpp:56
static void Save(const filesystem::path &path, const Pointer &transform)
Save a transform to a JSON file.
std::string Identifier
Definition: Transforms.hpp:59
static auto Load(const filesystem::path &path) -> Pointer
Load a transform from a JSON file.
Apply a transform to an ITKMesh.
Definition: core.hpp:963
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
Apply a transform to a PerPixelMap.
Definition: core.hpp:983
void deserialize_(const smgl::Metadata &meta, const filesystem::path &cacheDir) override
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
Get a transform by ID.
Definition: core.hpp:830
VolumePkg::Pointer vpkg_
Definition: core.hpp:833
auto serialize_(bool, const filesystem::path &) -> smgl::Metadata override
smgl::InputPort< Transform3D::Identifier > id
Transform ID.
Definition: core.hpp:843
smgl::InputPort< VolumePkg::Pointer > volpkg
Input VolumePkg.
Definition: core.hpp:841
smgl::OutputPort< Transform3D::Pointer > transform
Transform.
Definition: core.hpp:845
Transform3D::Pointer tfm_
Definition: core.hpp:837
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
Transform3D::Identifier id_
Definition: core.hpp:835
std::shared_ptr< UVMap > Pointer
Definition: UVMap.hpp:55
Retrieve VolumePkg properties (e.g. name, version, etc.)
Definition: core.hpp:64
smgl::InputPort< VolumePkg::Pointer > volpkg
Input VolumePkg.
Definition: core.hpp:71
VolumePkg::Pointer vpkg_
Definition: core.hpp:67
smgl::OutputPort< std::string > name
Returns the identifying name of the VolumePkg.
Definition: core.hpp:73
smgl::OutputPort< int > version
Returns the VolumePkg version.
Definition: core.hpp:75
smgl::OutputPort< double > materialThickness
Returns the approx. thickness of a material layer in microns (um).
Definition: core.hpp:77
std::shared_ptr< VolumePkg > Pointer
Definition: VolumePkg.hpp:61
Set/Retrieve Volume properties (voxel size, bounds, etc.)
Definition: core.hpp:126
smgl::InputPort< std::size_t > cacheMemory
Set the maximum size of the cache in bytes.
Definition: core.hpp:137
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::OutputPort< Volume::Pointer > volumeOut
Output Volume.
Definition: core.hpp:149
smgl::InputPort< Volume::Pointer > volumeIn
Input Volume.
Definition: core.hpp:135
auto serialize_(bool, const filesystem::path &) -> smgl::Metadata override
Volume::Pointer volume_
Definition: core.hpp:129
smgl::OutputPort< double > voxelSize
Get the voxel size (in microns)
Definition: core.hpp:142
smgl::OutputPort< Volume::Bounds > bounds
Get the bounding box.
Definition: core.hpp:140
Get a Volume by uuid.
Definition: core.hpp:89
smgl::InputPort< Volume::Identifier > id
Volume UUID.
Definition: core.hpp:102
Volume::Pointer vol_
Definition: core.hpp:96
smgl::InputPort< VolumePkg::Pointer > volpkg
Input VolumePkg.
Definition: core.hpp:100
auto serialize_(bool, const filesystem::path &) -> smgl::Metadata override
Volume::Identifier id_
Definition: core.hpp:94
VolumePkg::Pointer vpkg_
Definition: core.hpp:92
smgl::OutputPort< Volume::Pointer > volume
Volume.
Definition: core.hpp:104
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
std::shared_ptr< Volume > Pointer
Definition: Volume.hpp:42
std::shared_ptr< VolumetricMask > Pointer
Write image to the specified path.
Definition: core.hpp:539
smgl::InputPort< bool > cacheArgs
Include the saved file in the graph cache.
Definition: core.hpp:558
filesystem::path path_
Definition: core.hpp:542
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::InputPort< cv::Mat > image
Output image.
Definition: core.hpp:554
smgl::InputPort< WriteImageOpts > options
Image writer options.
Definition: core.hpp:556
smgl::InputPort< filesystem::path > path
Output file.
Definition: core.hpp:552
WriteImageOpts opts_
Definition: core.hpp:546
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
Write a sequence of images to disk.
Definition: core.hpp:581
smgl::InputPort< bool > cacheArgs
Include the saved file in the graph cache.
Definition: core.hpp:613
std::vector< cv::Mat > ImageSequence
Definition: core.hpp:584
void eagerWrite(std::size_t idx, std::size_t count, const cv::Mat &image) const
Write a single image from the sequence when in eager mode.
smgl::InputPort< filesystem::path > path
Output file.
Definition: core.hpp:598
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::InputPort< WriteImageOpts > options
Image writer options.
Definition: core.hpp:602
filesystem::path path_
Definition: core.hpp:586
smgl::InputPort< bool > eagerMode
Enable or disable eager write mode.
Definition: core.hpp:611
smgl::InputPort< ImageSequence > images
Output image sequence.
Definition: core.hpp:600
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
Write a mesh to a file.
Definition: core.hpp:295
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::InputPort< bool > cacheArgs
Include the saved file in the graph cache.
Definition: core.hpp:318
filesystem::path path_
Definition: core.hpp:298
smgl::InputPort< filesystem::path > path
Output file.
Definition: core.hpp:310
ITKMesh::Pointer mesh_
Definition: core.hpp:300
smgl::InputPort< cv::Mat > texture
Texture image.
Definition: core.hpp:316
UVMap::Pointer uv_
Definition: core.hpp:302
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::InputPort< UVMap::Pointer > uvMap
UV map.
Definition: core.hpp:314
smgl::InputPort< ITKMesh::Pointer > mesh
Mesh.
Definition: core.hpp:312
Write a PerPixelMap to disk.
Definition: core.hpp:688
void deserialize_(const smgl::Metadata &meta, const filesystem::path &) override
smgl::InputPort< PerPixelMap::Pointer > ppm
Output PerPixelMap.
Definition: core.hpp:701
filesystem::path path_
Definition: core.hpp:691
smgl::InputPort< filesystem::path > path
Output file.
Definition: core.hpp:699
PerPixelMap::Pointer ppm_
Definition: core.hpp:693
auto serialize_(bool useCache, const filesystem::path &cacheDir) -> smgl::Metadata override
smgl::InputPort< bool > cacheArgs
Include the saved file in the graph cache.
Definition: core.hpp:703
Volume Cartographer library
auto ApplyTransform(const ITKMesh::Pointer &mesh, const Transform3D::Pointer &transform, bool normalize=true) -> ITKMesh::Pointer
Apply a transform to an ITKMesh.
Result for ReadMesh.
Definition: MeshIO.hpp:16