MCPcopy Create free account
hub / github.com/Kitware/VTK / Export

Method Export

IO/Image/vtkImageExport.cxx:124–158  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Exports all the data from the input.

Source from the content-addressed store, hash-verified

122//------------------------------------------------------------------------------
123// Exports all the data from the input.
124void vtkImageExport::Export(void* output)
125{
126 void* ptr = this->GetPointerToData();
127 if (!ptr)
128 {
129 // GetPointerToData() outputs an error message.
130 return;
131 }
132
133 if (this->ImageLowerLeft)
134 {
135 memcpy(output, ptr, this->GetDataMemorySize());
136 }
137 else
138 { // flip the image when it is output
139 int* extent =
140 this->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
141 int xsize = extent[1] - extent[0] + 1;
142 int ysize = extent[3] - extent[2] + 1;
143 int zsize = extent[5] - extent[4] + 1;
144 int csize = this->GetInput()->GetScalarSize() * this->GetInput()->GetNumberOfScalarComponents();
145
146 for (vtkIdType i = 0; i < zsize; i++)
147 {
148 ptr = static_cast<void*>(static_cast<char*>(ptr) + ysize * xsize * csize);
149 for (vtkIdType j = 0; j < ysize; j++)
150 {
151 ptr = static_cast<void*>(static_cast<char*>(ptr) - xsize * csize);
152 memcpy(output, ptr, xsize * csize);
153 output = static_cast<void*>(static_cast<char*>(output) + xsize * csize);
154 }
155 ptr = static_cast<void*>(static_cast<char*>(ptr) + ysize * xsize * csize);
156 }
157 }
158}
159
160//------------------------------------------------------------------------------
161// Provides a valid pointer to the data (only valid until the next

Callers 2

ExportFunction · 0.45
ImportExportFunction · 0.45

Calls 7

GetPointerToDataMethod · 0.95
GetDataMemorySizeMethod · 0.95
GetInputInformationMethod · 0.95
GetInputMethod · 0.95
GetScalarSizeMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected