ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkWasmIOCommon.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkWasmIOCommon_h
19#define itkWasmIOCommon_h
20// Common functions used across the WebAssembly IO classes
21
22#include "WebAssemblyInterfaceExport.h"
23
24#include "itkIntTypes.h"
25#include "itkMath.h"
26#include "itkCommonEnums.h"
27
28#include <fstream>
29
30#include "cbor.h"
31
32namespace itk
33{
34
46WebAssemblyInterface_EXPORT void
47openFileForReading(std::ifstream & inputStream, const std::string & filename, bool ascii = false);
48
64WebAssemblyInterface_EXPORT void
65openFileForWriting(std::ofstream & outputStream,
66 const std::string & filename,
67 bool truncate = true,
68 bool ascii = false);
69
71WebAssemblyInterface_EXPORT bool
72readBufferAsBinary(std::istream & os, void * buffer, SizeValueType numberOfBytesToBeRead);
73
74WebAssemblyInterface_EXPORT bool
75fileNameIsCBOR(const char * fileName);
76
77WebAssemblyInterface_EXPORT void
78readCBORBuffer(const cbor_item_t * index, const char * dataName, void * buffer, SizeValueType numberOfBytesToBeRead);
79
80WebAssemblyInterface_EXPORT void
81writeCBORBuffer(cbor_item_t * index,
82 const char * dataName,
83 const void * buffer,
84 SizeValueType numberOfBytesToWrite,
85 IOComponentEnum ioComponent);
86
87WebAssemblyInterface_EXPORT size_t
89
90} // end namespace itk
91
92#endif // itkWasmIOCommon_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
WebAssemblyInterface_EXPORT void writeCBORBuffer(cbor_item_t *index, const char *dataName, const void *buffer, SizeValueType numberOfBytesToWrite, IOComponentEnum ioComponent)
WebAssemblyInterface_EXPORT vcl_size_t ITKComponentSize(const CommonEnums::IOComponent)
CommonEnums::IOComponent IOComponentEnum
WebAssemblyInterface_EXPORT void readCBORBuffer(const cbor_item_t *index, const char *dataName, void *buffer, SizeValueType numberOfBytesToBeRead)
WebAssemblyInterface_EXPORT void openFileForReading(std::ifstream &inputStream, const std::string &filename, bool ascii=false)
Opens a file for reading and random access.
unsigned long SizeValueType
Definition itkIntTypes.h:82
WebAssemblyInterface_EXPORT bool readBufferAsBinary(std::istream &os, void *buffer, SizeValueType numberOfBytesToBeRead)
WebAssemblyInterface_EXPORT void openFileForWriting(std::ofstream &outputStream, const std::string &filename, bool truncate=true, bool ascii=false)
Opens a file for writing and random access.
WebAssemblyInterface_EXPORT bool fileNameIsCBOR(const char *fileName)