From 61b4e431187d0838e0a4c321844f9c25fcab9cdf Mon Sep 17 00:00:00 2001 From: David Gobbi Date: Mon, 9 Jan 2017 09:59:13 -0700 Subject: [PATCH] Removed unused local variable from nifti writer. The vtkNIFTIImageWriter had a local variable "swapBytes" that was always equal to zero. The original intent was to allow the endianness of the file to be chosen, but this was never implemented. The writer always uses the native architecture endianness for the file, which is standard for NIFTI since the header specifies the endianness. --- IO/Image/vtkNIFTIImageWriter.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/IO/Image/vtkNIFTIImageWriter.cxx b/IO/Image/vtkNIFTIImageWriter.cxx index c903cc64052..4b305f78d09 100644 --- a/IO/Image/vtkNIFTIImageWriter.cxx +++ b/IO/Image/vtkNIFTIImageWriter.cxx @@ -22,7 +22,6 @@ #include "vtkInformationVector.h" #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkErrorCode.h" -#include "vtkByteSwap.h" #include "vtkMatrix4x4.h" #include "vtkMath.h" #include "vtkCommand.h" @@ -777,7 +776,6 @@ int vtkNIFTIImageWriter::RequestData( (this->OwnHeader->GetDataType() == NIFTI_TYPE_RGB24 || this->OwnHeader->GetDataType() == NIFTI_TYPE_RGBA32)); - int swapBytes = 0; int scalarSize = data->GetScalarSize(); int numComponents = data->GetNumberOfScalarComponents(); int outSizeX = static_cast(this->OwnHeader->GetDim(1)); @@ -799,7 +797,7 @@ int vtkNIFTIImageWriter::RequestData( // add a buffer for planar-vector to packed-vector conversion unsigned char *rowBuffer = 0; - if (vectorDim > 1 || planarRGB || swapBytes) + if (vectorDim > 1 || planarRGB) { rowBuffer = new unsigned char[outSizeX*fileVoxelIncr]; } @@ -846,7 +844,7 @@ int vtkNIFTIImageWriter::RequestData( while (!this->AbortExecute && !this->ErrorCode) { - if (vectorDim == 1 && !planarRGB && !swapBytes) + if (vectorDim == 1 && !planarRGB) { // write directly from input, instead of using a buffer rowBuffer = ptr; @@ -867,11 +865,6 @@ int vtkNIFTIImageWriter::RequestData( } } - if (swapBytes != 0 && scalarSize > 1) - { - vtkByteSwap::SwapVoidRange(rowBuffer, rowSize, scalarSize); - } - if (isCompressed) { int code = gzwrite(file, rowBuffer, rowSize*scalarSize); @@ -932,7 +925,7 @@ int vtkNIFTIImageWriter::RequestData( // only delete this if it was alloced (if it was not alloced, it // would have been set directly to a row out the output image) - if (vectorDim > 1 || swapBytes || planarRGB) + if (vectorDim > 1 || planarRGB) { delete [] rowBuffer; }