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

Method ReadMINCFileAttributes

IO/MINC/vtkMINCImageReader.cxx:314–686  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

312
313//------------------------------------------------------------------------------
314int vtkMINCImageReader::ReadMINCFileAttributes()
315{
316 // If the filename hasn't changed since the last time the attributes
317 // were read, don't read them again.
318 if (!this->FileNameHasChanged)
319 {
320 return 1;
321 }
322
323 // Reset the MINC information for the file.
324 this->MINCImageType = 0;
325 this->MINCImageTypeSigned = 1;
326
327 this->NumberOfTimeSteps = 1;
328 this->DirectionCosines->Identity();
329
330 // Orientation set tells us which direction cosines were found
331 int orientationSet[3] = { 0, 0, 0 };
332
333 this->ImageAttributes->Reset();
334
335 // Miscellaneous NetCDF variables
336 int status = 0;
337 int ncid = 0;
338 int dimid = 0;
339 int varid = 0;
340 int ndims = 0;
341 int nvars = 0;
342 int ngatts = 0;
343 int unlimdimid = 0;
344
345 if (this->OpenNetCDFFile(this->GetFileName(), ncid) == 0)
346 {
347 return 0;
348 }
349
350 // Get the basic information for the file. The ndims are
351 // ignored here, because we only want the dimensions that
352 // belong to the image variable.
353 status = nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid);
354 if (status != NC_NOERR)
355 {
356 vtkMINCImageReaderFailAndClose(ncid, status);
357 return 0;
358 }
359 if (ndims > VTK_MINC_MAX_DIMS)
360 {
361 vtkErrorMacro("MINC file has " << ndims
362 << ", but this reader"
363 " only supports "
364 << VTK_MINC_MAX_DIMS << ".");
365 return 0;
366 }
367
368 // Go through all the variables in the MINC file. A varid of -1
369 // is used to signal global attributes.
370 for (varid = -1; varid < nvars; varid++)
371 {

Callers 7

GetDirectionCosinesMethod · 0.95
GetRescaleSlopeMethod · 0.95
GetRescaleInterceptMethod · 0.95
GetDataRangeMethod · 0.95
GetNumberOfTimeStepsMethod · 0.95
GetImageAttributesMethod · 0.95
ExecuteInformationMethod · 0.95

Calls 15

OpenNetCDFFileMethod · 0.95
CloseNetCDFFileMethod · 0.95
nc_inqFunction · 0.85
nc_inq_varFunction · 0.85
nc_inq_attnameFunction · 0.85
nc_inq_attFunction · 0.85
nc_get_att_ucharFunction · 0.85
nc_get_att_textFunction · 0.85
nc_get_att_shortFunction · 0.85
nc_get_att_intFunction · 0.85
nc_get_att_floatFunction · 0.85

Tested by

no test coverage detected