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

Method ExecuteDataWithInformation

IO/MINC/vtkMINCImageReader.cxx:1080–1319  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1078
1079//------------------------------------------------------------------------------
1080void vtkMINCImageReader::ExecuteDataWithInformation(vtkDataObject* output, vtkInformation* outInfo)
1081{
1082 vtkImageData* data = this->AllocateOutputData(output, outInfo);
1083 int scalarType = data->GetScalarType();
1084 int scalarSize = data->GetScalarSize();
1085 int numComponents = data->GetNumberOfScalarComponents();
1086 int outExt[6];
1087 this->GetOutputInformation(0)->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), outExt);
1088 vtkIdType outInc[3];
1089 data->GetIncrements(outInc);
1090 int outSize[3];
1091 data->GetDimensions(outSize);
1092
1093 void* outPtr = data->GetScalarPointerForExtent(outExt);
1094
1095 int timeStep = this->TimeStep;
1096 if (timeStep < 0 || timeStep >= this->NumberOfTimeSteps)
1097 {
1098 vtkWarningMacro("TimeStep is set to " << this->TimeStep << " but there are only "
1099 << this->NumberOfTimeSteps << " time steps.");
1100 timeStep = timeStep % this->NumberOfTimeSteps;
1101 }
1102
1103 int status = 0;
1104 int ncid = 0;
1105 int varid = 0;
1106
1107 if (this->OpenNetCDFFile(this->GetFileName(), ncid) == 0)
1108 {
1109 return;
1110 }
1111
1112 // Get the image variable.
1113 status = nc_inq_varid(ncid, MIimage, &varid);
1114 if (status != NC_NOERR)
1115 {
1116 vtkMINCImageReaderFailAndClose(ncid, status);
1117 return;
1118 }
1119
1120 // Get the dimensions.
1121 vtkStringArray* dimensionNames = this->ImageAttributes->GetDimensionNames();
1122 vtkIdTypeArray* dimensionLengths = this->ImageAttributes->GetDimensionLengths();
1123 int ndims = dimensionNames->GetNumberOfValues();
1124 int idim = 0;
1125 int nminmaxdims = this->ImageAttributes->GetNumberOfImageMinMaxDimensions();
1126 vtkIdType minmaxSize = 0;
1127 if (this->ImageAttributes->GetImageMin())
1128 {
1129 minmaxSize = this->ImageAttributes->GetImageMin()->GetNumberOfTuples();
1130 }
1131
1132 // The default dimensionality of the chunks that are used.
1133 int nchunkdims = ndims - nminmaxdims;
1134
1135 // All of these values will be changed in the following loop
1136 vtkIdType nchunks = 1;
1137 vtkIdType numTimeSteps = 1;

Callers

nothing calls this directly

Calls 15

OpenNetCDFFileMethod · 0.95
CloseNetCDFFileMethod · 0.95
nc_inq_varidFunction · 0.85
GetScalarSizeMethod · 0.80
GetIncrementsMethod · 0.80
AllocateOutputDataMethod · 0.45
GetScalarTypeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected