Back to the main page.

Bug 2799 - not cleaning up .hdr file: align_itab2spm and align_ctf2spm

Status CLOSED FIXED
Reported 2015-01-06 12:13:00 +0100
Modified 2015-01-12 09:18:01 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P4 minor
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Daniel Miklody - 2015-01-06 12:13:58 +0100


Daniel Miklody - 2015-01-06 12:15:02 +0100

The functions align_itab2spm and align_ctf2spm miss to cleanup the temporary .hdr files.. they only delete the .img file....


Jan-Mathijs Schoffelen - 2015-01-09 09:23:11 +0100

Could you suggest a fix?


Daniel Miklody - 2015-01-09 12:16:04 +0100

yes! replace lines 77 to 80 and 102 to 103 in align_itab2spm: 77 tname1 = [tempname, '.img']; 78 tname2 = [tempname, '.img']; 79 V1 = ft_write_mri(tname1, mri.anatomy, 'transform', mri.transform, 80 spmversion', spm('ver')); 80 V2 = ft_write_mri(tname2, mri2.anatomy, 'transform', mri2.transform, 'spmversion', spm('ver')); 102 delete(tname1); 103 delete(tname2); by: 77 tname1 = tempname; 78 tname2 = tempname; 79 V1 = ft_write_mri([tname1, '.img'], mri.anatomy, 'transform', mri.transform, 80 spmversion', spm('ver')); 80 V2 = ft_write_mri([tname2, '.img'], mri2.anatomy, 'transform', mri2.transform, 'spmversion', spm('ver')); 102 delete([tname1, '.img'],[tname1, '.hdr'],[tname2, '.img'],[tname2, '.hdr']); 103 and do it similarly with lines 118-121 and 140-141. Do the almost the same with lines 90-93 and 115-116, also 139-142 and 161-162 in align_ctf2spm....


Daniel Miklody - 2015-01-09 12:18:12 +0100

oh, I added an "80" to line 79 and in my code without realizing. works probably better without that.


Jan-Mathijs Schoffelen - 2015-01-09 12:31:14 +0100

Thanks! We'll look into it.


Jan-Mathijs Schoffelen - 2015-01-10 09:40:54 +0100

[jansch@mentat003 private]$ svn commit -m "enhancement - also remove the temporary hdr files, as per bug 2799" align_itab2spm.m align_ctf2spm.m Sending align_ctf2spm.m Sending align_itab2spm.m Transmitting file data .. Committed revision 10092. Thanks Daniel! I solved it by doing an additional delete(strrep(tname1, 'img', 'hdr')); (also for tname2). [jansch@mentat003 private]$ svn commit -m "enhancement - also remove the temporary hdr files, which despite Daniel's instructions I missed" align_itab2spm.m align_ctf2spm.m Sending align_ctf2spm.m Sending align_itab2spm.m Transmitting file data .. Committed revision 10093.


Jan-Mathijs Schoffelen - 2015-01-10 09:41:09 +0100

I think it is now fixed.


Daniel Miklody - 2015-01-10 19:46:42 +0100

Well, that was even more source code change efficient! Good job! :)