------------------------------------------------------------------------------ Write out the UpdateExtent of the input data. Note that MINC has to calculate the scalar range of each slice before writing it, therefore the UpdateExtent must contain whole slices, otherwise the range won't be properly calculated.
| 1507 | // therefore the UpdateExtent must contain whole slices, otherwise |
| 1508 | // the range won't be properly calculated. |
| 1509 | int vtkMINCImageWriter::WriteMINCData( |
| 1510 | vtkImageData* data, int timeStep, int inWholeExt[6], int inExt[6]) |
| 1511 | { |
| 1512 | int scalarType = data->GetScalarType(); |
| 1513 | int scalarSize = data->GetScalarSize(); |
| 1514 | int numComponents = data->GetNumberOfScalarComponents(); |
| 1515 | int numTimeSteps = this->GetNumberOfInputConnections(0); |
| 1516 | vtkIdType inInc[3]; |
| 1517 | data->GetIncrements(inInc); |
| 1518 | |
| 1519 | void* inPtr = data->GetScalarPointerForExtent(inExt); |
| 1520 | |
| 1521 | int status = 0; |
| 1522 | int ncid = this->MINCFileId; |
| 1523 | int varid = 0; |
| 1524 | int minid = 0; |
| 1525 | int maxid = 0; |
| 1526 | |
| 1527 | // Whether to rescale the data |
| 1528 | int rescale = !this->ComputeValidRangeFromScalarRange; |
| 1529 | |
| 1530 | // Get the image variable. |
| 1531 | status = nc_inq_varid(ncid, MIimage, &varid); |
| 1532 | // Get the image-min variable. |
| 1533 | if (rescale) |
| 1534 | { |
| 1535 | if (status == NC_NOERR) |
| 1536 | { |
| 1537 | status = nc_inq_varid(ncid, MIimagemin, &minid); |
| 1538 | } |
| 1539 | // Get the image-max variable. |
| 1540 | if (status == NC_NOERR) |
| 1541 | { |
| 1542 | status = nc_inq_varid(ncid, MIimagemax, &maxid); |
| 1543 | } |
| 1544 | } |
| 1545 | |
| 1546 | if (status != NC_NOERR) |
| 1547 | { |
| 1548 | vtkMINCImageWriterFailAndClose(ncid, status); |
| 1549 | this->MINCFileId = 0; |
| 1550 | return 0; |
| 1551 | } |
| 1552 | |
| 1553 | // Get the rescaling parameters |
| 1554 | double rescaleSlope = this->InternalRescaleSlope; |
| 1555 | double rescaleIntercept = this->InternalRescaleIntercept; |
| 1556 | |
| 1557 | // Get the dimensions. |
| 1558 | int ndims = this->FileDimensionNames->GetNumberOfValues(); |
| 1559 | int idim = 0; |
| 1560 | int nminmaxdims = this->MINCImageMinMaxDims; |
| 1561 | |
| 1562 | // All of these values will be changed in the following loop |
| 1563 | vtkIdType nchunks = 1; |
| 1564 | vtkIdType chunkSize = 1; |
| 1565 | vtkIdType chunkInc = 0; |
| 1566 |
no test coverage detected