------------------------------------------------------------------------------
| 312 | |
| 313 | //------------------------------------------------------------------------------ |
| 314 | int 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 | { |
no test coverage detected