made a fatal error because of the memory release at the end of program.
The problem was in vtkGdcmReader::ExecuteData where we were allocate
some memory and vtk seems to have some problems with that.
* src/gdcmHeaderEntrySet.cxx : bug fix for std lib and cout
-- BeNours
+2004-01-15 Benoit Regrain
+ * vtk/vtkGdcmReader.cxx : bug fix : before, with python only, the program
+ made a fatal error because of the memory release at the end of program.
+ The problem was in vtkGdcmReader::ExecuteData where we were allocate
+ some memory and vtk seems to have some problems with that.
+ * src/gdcmHeaderEntrySet.cxx : bug fix for std lib and cout
+
2004-01-14 Benoit Regrain
* src/gdcmHeaderEntry.[h|cxx] : gdcmElValue -> gdcmHeaderEntry
* src/gdcmHeaderEntrySet.[h|cxx] : gdcmElValSet -> gdcmHeaderEntrySet
}
s << std::endl;
}
- os<<s.str();
// List element
guint32 lgth;
char greltag[10]; //group element tag
- std::cout << "------------ using listEntries ----------------" << std::endl;
+ s << "------------ using listEntries ----------------" << std::endl;
char st[11];
for (ListTag::iterator i = listEntries.begin();
o = (*i)->GetOffset();
sprintf(greltag,"%04x|%04x",g,e);
d2 = _CreateCleanString(v); // replace non printable characters by '.'
- cout << greltag << " lg : ";
+ s << greltag << " lg : ";
lgth = (*i)->GetReadLength();
sprintf(st,"x(%x)",lgth);
- std::cout.setf(ios::left);
- std::cout << setw(10-strlen(st)) << " ";
- std::cout << st << " ";
- std::cout.setf(ios::left);
- std::cout << setw(8) << lgth;
- std::cout << " Off.: ";
+ s.setf(std::ios::left);
+ s << std::setw(10-strlen(st)) << " ";
+ s << st << " ";
+ s.setf(std::ios::left);
+ s << std::setw(8) << lgth;
+ s << " Off.: ";
sprintf(st,"x(%x)",o);
- std::cout << setw(10-strlen(st)) << " ";
- std::cout << st << " ";
- std::cout << setw(8) << o;
- std::cout << "[" << (*i)->GetVR() << "] ";
- std::cout.setf(ios::left);
- std::cout << setw(66-(*i)->GetName().length()) << " ";
- std::cout << "[" << (*i)->GetName()<< "] ";
- std::cout << "[" << d2 << "]";
+ s << std::setw(10-strlen(st)) << " ";
+ s << st << " ";
+ s << std::setw(8) << o;
+ s << "[" << (*i)->GetVR() << "] ";
+ s.setf(std::ios::left);
+ s << std::setw(66-(*i)->GetName().length()) << " ";
+ s << "[" << (*i)->GetName()<< "] ";
+ s << "[" << d2 << "]";
// Display the UID value (instead of displaying the rough code)
if (g == 0x0002) { // Any more to be displayed ?
if ( (e == 0x0010) || (e == 0x0002) )
- std::cout << " ==>\t[" << ts->GetValue(v) << "]";
+ s << " ==>\t[" << ts->GetValue(v) << "]";
} else {
if (g == 0x0008) {
if ( (e == 0x0016) || (e == 0x1150) )
- std::cout << " ==>\t[" << ts->GetValue(v) << "]";
+ s << " ==>\t[" << ts->GetValue(v) << "]";
}
}
- std::cout << std::endl;
+ s << std::endl;
}
+
+ os<<s.str();
}
//-----------------------------------------------------------------------------
}
vtkGdcmReader::~vtkGdcmReader()
-{
+{
this->RemoveAllFileName();
this->InternalFileNameList.clear();
if(this->LookupTable)
// Print
void vtkGdcmReader::PrintSelf(ostream& os, vtkIndent indent)
{
- vtkImageReader::PrintSelf(os,indent);
- os << indent << "Filenames : " << endl;
- vtkIndent nextIndent = indent.GetNextIndent();
- for (std::list<std::string>::iterator FileName = FileNameList.begin();
- FileName != FileNameList.end();
- ++FileName)
- {
- os << nextIndent << FileName->c_str() << endl ;
- }
+ vtkImageReader::PrintSelf(os,indent);
+ os << indent << "Filenames : " << endl;
+ vtkIndent nextIndent = indent.GetNextIndent();
+ for (std::list<std::string>::iterator FileName = FileNameList.begin();
+ FileName != FileNameList.end();
+ ++FileName)
+ {
+ os << nextIndent << FileName->c_str() << endl ;
+ }
}
//-----------------------------------------------------------------------------
//Set number of scalar components:
this->SetNumberOfScalarComponents(this->NumComponents);
- vtkImageReader::ExecuteInformation();
+ this->Superclass::ExecuteInformation();
}
/*
* this->TotalNumberOfPlanes * this->NumComponents;
size_t stack_size = StackNumPixels * this->PixelSize;
// Allocate pixel data space itself.
- unsigned char *mem = new unsigned char [stack_size];
// Variables for the UpdateProgress. We shall use 50 steps to signify
// the advance of the process:
unsigned long UpdateProgressCount = 0;
// Feeling the allocated memory space with each image/volume:
- unsigned char * Dest = mem;
+ unsigned char *Dest = (unsigned char *)data->GetPointData()->GetScalars()->GetVoidPointer(0);
for (std::list<std::string>::iterator FileName = InternalFileNameList.begin();
FileName != InternalFileNameList.end();
++FileName)
}
} // Else, file not loadable
} // Loop on files
-
- // The "size" of the vtkScalars data is expressed in number of points,
- // and is not the memory size representing those points:
- data->GetPointData()->GetScalars()->SetVoidArray(mem, StackNumPixels, 0);
- //don't know why it's here, it's calling one more time ExecuteInformation:
- //this->Modified();
}
}