Skip to content

Commit

Permalink
Removed unused local variable from nifti writer.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgobbi committed Jan 9, 2017
1 parent 1fab2a9 commit 61b4e43
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions IO/Image/vtkNIFTIImageWriter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<int>(this->OwnHeader->GetDim(1));
Expand All @@ -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];
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 61b4e43

Please sign in to comment.