I'm sure this is a case of not being able to see the obvious, but here goes. Keep in mind that I'm more than rusty with C/C++, so please treat me as a complete beginner.
I tried to separate out some templated functions, and g++ is now now giving me error messages like:
./src/nifti2normts.c++: In function ‘int transform_data(nifti_image*) [with SData = float, LData = double]’:
./src/nifti2normts.c++:275:50: instantiated from here
./src/nifti2normts.c++:229:3: error: no matching function for call to ‘load_to_txyz(float*&, float*&, unsigned int&, unsigned int&, double&)’ |
The code is somewhat convoluted, but hopefully I've included the salient parts here.
The function I'm expecting to match is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
72: template<typename SData, typename LData>
73: int load_to_txyz(SData old_data, SData new_data, UINT timeseries_count, UINT timeseries_length) {
74: UINT voxel_count = timeseries_count * timeseries_length;
75: struct timeval t0;
76: printf("Loading data into RAM in TXYZ format....\n");
77: gettimeofday(&t0, NULL);
78: UINT input_idx = 0;
79: for(input_idx = 0; input_idx < voxel_count; ++ input_idx) {
80: UINT idx_of_timeseries = input_idx % timeseries_count;
81: UINT idx_in_timeseries = input_idx / timeseries_count;
82: UINT new_idx = (idx_of_timeseries * timeseries_length) + idx_in_timeseries;
83: new_data[new_idx] = old_data[input_idx];
84: }
85: printf("Loaded %d voxels into RAM in TXYZ format in %s seconds.\n",input_idx,bufSprintf("%0.6lf",tock(t0)));
86: return 1;
87: }
|
The code at line 229 is (timeseries_count and timeseries_length are unsigned ints):
1 2 3 4 5 6
|
182: template<typename SData, typename LData> int transform_data(nifti_image * nifti_img) {
[...]
229: if(! load_to_txyz<SData,LData>(old_data,new_data,timeseries_count,timeseries_length)) {
230: printf("ERROR: Load file to TXZY failed!\n");
231: return -1;
232: }
|
At 275 it's:
1 2 3
|
274: case DT_FLOAT:
275: return transform_data<float,double>(nifti_img);
276 break;
|
Any ideas?
I can't post the whole code (too long), but hopefully the problem is in what I have posted.
Thanks!
**NOTE: Edited to reflect updated code RE: Zhuge's comment.
**NOTE: Added UINT definition, and types information for timeseries_count and timeseries_length)