Skip to content
Snippets Groups Projects
Commit d10ee2e5 authored by Adrian Groves's avatar Adrian Groves
Browse files

Added error-checking to writeAsFloat() to check that dimensions are consistent.

Currently only prints a warning (adding an assert seemed too dangerous for production code).
parent 78c36d65
No related branches found
No related tags found
No related merge requests found
......@@ -234,6 +234,13 @@ namespace MISCMATHS {
int volSize = getNumSeries();
int volNum = getNumVolumes();
// This should assert() but I'm too scared to add that to production code!
if ( (volinfo.x * volinfo.y * volinfo.z != volSize) || (volinfo.v != volNum) )
cerr << "WARNING: Dimensions are inconsistent in VolumeSeries::writeAsFloat()\n"
<< "x, y, z, v = " << volinfo.x << ", " << volinfo.y << ", " << volinfo.z
<< ", " << volinfo.v << "\nvolSize, volNum = " << volSize << ", "
<< volNum << "\nThis is probably NOT what you intended!!" << endl;
FslWriteHeader(OP);
float *qv = new float[volSize];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment