Commit 87f403db authored by Sean McBride's avatar Sean McBride

Minor improvements to type matching, style, etc.

parent 325ef8b2
...@@ -263,8 +263,8 @@ void vtkMINCImageAttributes::AddDimension(const char *dimension, ...@@ -263,8 +263,8 @@ void vtkMINCImageAttributes::AddDimension(const char *dimension,
vtkIdType length) vtkIdType length)
{ {
// Check for duplicates // Check for duplicates
int n = this->DimensionNames->GetNumberOfValues(); vtkIdType n = this->DimensionNames->GetNumberOfValues();
for (int i = 0; i < n; i++) for (vtkIdType i = 0; i < n; i++)
{ {
if (strcmp(dimension, this->DimensionNames->GetValue(i)) == 0) if (strcmp(dimension, this->DimensionNames->GetValue(i)) == 0)
{ {
...@@ -308,8 +308,8 @@ const char *vtkMINCImageAttributes::ConvertDataArrayToString( ...@@ -308,8 +308,8 @@ const char *vtkMINCImageAttributes::ConvertDataArrayToString(
std::ostringstream os; std::ostringstream os;
int n = array->GetNumberOfTuples(); vtkIdType n = array->GetNumberOfTuples();
int i = 0; vtkIdType i = 0;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
double val = array->GetComponent(i, 0); double val = array->GetComponent(i, 0);
...@@ -421,12 +421,12 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os) ...@@ -421,12 +421,12 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os)
os << "netcdf " << name << " {\n"; os << "netcdf " << name << " {\n";
os << "dimensions:\n"; os << "dimensions:\n";
int ndim = 0; vtkIdType ndim = 0;
if (this->DimensionNames) if (this->DimensionNames)
{ {
ndim = this->DimensionNames->GetNumberOfValues(); ndim = this->DimensionNames->GetNumberOfValues();
} }
for (int idim = 0; idim < ndim; idim++) for (vtkIdType idim = 0; idim < ndim; idim++)
{ {
os << "\t" << this->DimensionNames->GetValue(idim) << " = " os << "\t" << this->DimensionNames->GetValue(idim) << " = "
<< this->DimensionLengths->GetValue(idim) << " ;\n"; << this->DimensionLengths->GetValue(idim) << " ;\n";
...@@ -434,8 +434,8 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os) ...@@ -434,8 +434,8 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os)
os << "variables:\n"; os << "variables:\n";
int nvar = 0; vtkIdType nvar = 0;
int ivar = 0; vtkIdType ivar = 0;
if (this->VariableNames) if (this->VariableNames)
{ {
nvar = this->VariableNames->GetNumberOfValues(); nvar = this->VariableNames->GetNumberOfValues();
...@@ -455,7 +455,7 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os) ...@@ -455,7 +455,7 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os)
strcmp(varname, MIimagemin) == 0) strcmp(varname, MIimagemin) == 0)
{ {
os << "\t" << imageDataType << " " << varname; os << "\t" << imageDataType << " " << varname;
int nvardim = this->DimensionNames->GetNumberOfValues(); vtkIdType nvardim = this->DimensionNames->GetNumberOfValues();
// If this is image-min or image-max, only print the // If this is image-min or image-max, only print the
// dimensions for these variables // dimensions for these variables
if (varname[5] == '-') if (varname[5] == '-')
...@@ -490,8 +490,8 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os) ...@@ -490,8 +490,8 @@ void vtkMINCImageAttributes::PrintFileHeader(ostream &os)
this->AttributeNames->GetStringArray(varname); this->AttributeNames->GetStringArray(varname);
if (attArray) if (attArray)
{ {
int natt = attArray->GetNumberOfValues(); vtkIdType natt = attArray->GetNumberOfValues();
for (int iatt = 0; iatt < natt; iatt++) for (vtkIdType iatt = 0; iatt < natt; iatt++)
{ {
const char *attname = attArray->GetValue(iatt); const char *attname = attArray->GetValue(iatt);
vtkDataArray *array = vtkDataArray *array =
...@@ -816,8 +816,8 @@ void vtkMINCImageAttributes::SetAttributeValueAsArray( ...@@ -816,8 +816,8 @@ void vtkMINCImageAttributes::SetAttributeValueAsArray(
this->AttributeValues->AddArray(array); this->AttributeValues->AddArray(array);
// Add to variable to VariableNames // Add to variable to VariableNames
int n = this->VariableNames->GetNumberOfValues(); vtkIdType n = this->VariableNames->GetNumberOfValues();
int i = 0; vtkIdType i = 0;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
if (strcmp(this->VariableNames->GetValue(i), variable) == 0) if (strcmp(this->VariableNames->GetValue(i), variable) == 0)
...@@ -1409,8 +1409,8 @@ void vtkMINCImageAttributes::FindValidRange(double range[2]) ...@@ -1409,8 +1409,8 @@ void vtkMINCImageAttributes::FindValidRange(double range[2])
if (this->DataType == VTK_FLOAT) if (this->DataType == VTK_FLOAT)
{ {
// use float precision if VTK_FLOAT // use float precision if VTK_FLOAT
range[0] = (float)range[0]; range[0] = static_cast<float>(range[0]);
range[1] = (float)range[1]; range[1] = static_cast<float>(range[1]);
} }
} }
else else
...@@ -1515,8 +1515,8 @@ void vtkMINCImageAttributes::ShallowCopy(vtkMINCImageAttributes *source) ...@@ -1515,8 +1515,8 @@ void vtkMINCImageAttributes::ShallowCopy(vtkMINCImageAttributes *source)
this->AttributeNames->Clear(); this->AttributeNames->Clear();
vtkStringArray *varnames = source->GetVariableNames(); vtkStringArray *varnames = source->GetVariableNames();
int nvar = varnames->GetNumberOfValues(); vtkIdType nvar = varnames->GetNumberOfValues();
for (int ivar = 0; ivar <= nvar; ivar++) for (vtkIdType ivar = 0; ivar <= nvar; ivar++)
{ {
// set varname to emtpy last time around to get global attributes // set varname to emtpy last time around to get global attributes
const char *varname = MI_EMPTY_STRING; const char *varname = MI_EMPTY_STRING;
...@@ -1525,8 +1525,8 @@ void vtkMINCImageAttributes::ShallowCopy(vtkMINCImageAttributes *source) ...@@ -1525,8 +1525,8 @@ void vtkMINCImageAttributes::ShallowCopy(vtkMINCImageAttributes *source)
varname = varnames->GetValue(ivar); varname = varnames->GetValue(ivar);
} }
vtkStringArray *attnames = source->GetAttributeNames(varname); vtkStringArray *attnames = source->GetAttributeNames(varname);
int natt = attnames->GetNumberOfValues(); vtkIdType natt = attnames->GetNumberOfValues();
for (int iatt = 0; iatt < natt; iatt++) for (vtkIdType iatt = 0; iatt < natt; iatt++)
{ {
const char *attname = attnames->GetValue(iatt); const char *attname = attnames->GetValue(iatt);
this->SetAttributeValueAsArray( this->SetAttributeValueAsArray(
...@@ -1539,4 +1539,3 @@ void vtkMINCImageAttributes::ShallowCopy(vtkMINCImageAttributes *source) ...@@ -1539,4 +1539,3 @@ void vtkMINCImageAttributes::ShallowCopy(vtkMINCImageAttributes *source)
this->StringStore->Reset(); this->StringStore->Reset();
} }
} }
...@@ -379,10 +379,7 @@ int vtkMINCImageReader::ReadMINCFileAttributes() ...@@ -379,10 +379,7 @@ int vtkMINCImageReader::ReadMINCFileAttributes()
this->DirectionCosines->Identity(); this->DirectionCosines->Identity();
// Orientation set tells us which direction cosines were found // Orientation set tells us which direction cosines were found
int orientationSet[3]; int orientationSet[3] = {0, 0, 0};
orientationSet[0] = 0;
orientationSet[1] = 0;
orientationSet[2] = 0;
this->ImageAttributes->Reset(); this->ImageAttributes->Reset();
...@@ -835,16 +832,11 @@ void vtkMINCImageReader::ExecuteInformation() ...@@ -835,16 +832,11 @@ void vtkMINCImageReader::ExecuteInformation()
} }
// Set the VTK information from the MINC information. // Set the VTK information from the MINC information.
int dataExtent[6]; int dataExtent[6] = {0, 0, 0, 0, 0, 0};
dataExtent[0] = dataExtent[1] = 0;
dataExtent[2] = dataExtent[3] = 0;
dataExtent[4] = dataExtent[5] = 0;
double dataSpacing[3]; double dataSpacing[3] = {1.0, 1.0, 1.0};
dataSpacing[0] = dataSpacing[1] = dataSpacing[2] = 1.0;
double dataOrigin[3]; double dataOrigin[3] = {0.0, 0.0, 0.0};
dataOrigin[0] = dataOrigin[1] = dataOrigin[2] = 0.0;
int numberOfComponents = 1; int numberOfComponents = 1;
...@@ -895,8 +887,8 @@ void vtkMINCImageReader::ExecuteInformation() ...@@ -895,8 +887,8 @@ void vtkMINCImageReader::ExecuteInformation()
vtkIdTypeArray *dimensionLengths = vtkIdTypeArray *dimensionLengths =
this->ImageAttributes->GetDimensionLengths(); this->ImageAttributes->GetDimensionLengths();
int numberOfDimensions = dimensionNames->GetNumberOfValues(); unsigned int numberOfDimensions = dimensionNames->GetNumberOfValues();
for (int i = 0; i < numberOfDimensions; i++) for (unsigned int i = 0; i < numberOfDimensions; i++)
{ {
const char *dimName = dimensionNames->GetValue(i); const char *dimName = dimensionNames->GetValue(i);
vtkIdType dimLength = dimensionLengths->GetValue(i); vtkIdType dimLength = dimensionLengths->GetValue(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment