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

Method WriteData

IO/Legacy/vtkStructuredPointsWriter.cxx:18–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16vtkStandardNewMacro(vtkStructuredPointsWriter);
17
18void vtkStructuredPointsWriter::WriteData()
19{
20 ostream* fp;
21 vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput());
22 int dim[3];
23 int* ext;
24 double spacing[3], origin[3];
25
26 vtkDebugMacro(<< "Writing vtk structured points...");
27
28 if (!(fp = this->OpenVTKFile()) || !this->WriteHeader(fp))
29 {
30 if (fp)
31 {
32 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
33 this->CloseVTKFile(fp);
34 unlink(this->FileName);
35 }
36 return;
37 }
38 //
39 // Write structured points specific stuff
40 //
41 *fp << "DATASET STRUCTURED_POINTS\n";
42
43 // Write data owned by the dataset
44 if (!this->WriteDataSetData(fp, input))
45 {
46 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
47 this->CloseVTKFile(fp);
48 unlink(this->FileName);
49 return;
50 }
51
52 if (this->WriteExtent)
53 {
54 int extent[6];
55 input->GetExtent(extent);
56 *fp << "EXTENT " << extent[0] << " " << extent[1] << " " << extent[2] << " " << extent[3] << " "
57 << extent[4] << " " << extent[5] << "\n";
58 }
59 else
60 {
61 input->GetDimensions(dim);
62 *fp << "DIMENSIONS " << dim[0] << " " << dim[1] << " " << dim[2] << "\n";
63 }
64
65 input->GetSpacing(spacing);
66 *fp << "SPACING " << spacing[0] << " " << spacing[1] << " " << spacing[2] << "\n";
67
68 input->GetOrigin(origin);
69 if (this->WriteExtent)
70 {
71 *fp << "ORIGIN " << origin[0] << " " << origin[1] << " " << origin[2] << "\n";
72 }
73 else
74 {
75 // Do the electric slide. Move origin to min corner of extent.

Callers

nothing calls this directly

Calls 11

GetInputMethod · 0.95
WriteDataSetDataMethod · 0.80
OpenVTKFileMethod · 0.45
WriteHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
GetExtentMethod · 0.45
GetDimensionsMethod · 0.45
GetSpacingMethod · 0.45
GetOriginMethod · 0.45
WriteCellDataMethod · 0.45
WritePointDataMethod · 0.45

Tested by

no test coverage detected