Skip to content
Snippets Groups Projects
Commit bb4110e9 authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Made it work properly

parent cb7ea722
No related branches found
No related tags found
No related merge requests found
......@@ -37,11 +37,12 @@ int main(argc,argv)
char thestring[10000];
/* struct dsr hdr, hdr2; */
FSLIO *src = NULL, *dest = NULL;
short need_to_copy = 0, x, y, z, v, copydim=1;
short x, y, z, v, copydim=1, t;
float vx, vy, vz, tr;
char c;
short orig[5];
void *buffer = NULL;
char desthdrname[10000];
if (argc<3)
usage();
......@@ -64,21 +65,21 @@ int main(argc,argv)
exit(EXIT_FAILURE);
}
if ( FslGetFileType(dest) == FSL_TYPE_NIFTI_GZ ) {
short t;
need_to_copy = 1;
/* Read all the destination volumes... */
FslGetDim(dest, &x, &y, &z, &v);
if( (buffer = malloc(x * y * z * v * (FslGetDataType(dest, &t) / 8))) == NULL ) {
perror("Unable to allocate memory for NIFTI_GZ copy");
exit(EXIT_FAILURE);
}
FslReadVolumes(dest, buffer, v);
/* Read all the destination volumes... */
FslGetDim(dest, &x, &y, &z, &v);
if( (buffer = malloc(x * y * z * v * (FslGetDataType(dest, &t) / 8))) == NULL ) {
perror("Unable to allocate memory for copy");
exit(EXIT_FAILURE);
}
FslReadVolumes(dest, buffer, v);
strcpy(desthdrname,dest->niftiptr->fname);
FslClose(dest);
/* ...and now reopen destination for writing */
dest = FslOpen(argv[2], "w");
dest = FslOpen(desthdrname, "w");
FslCloneHeader(dest,src);
/* }}} */
/* {{{ copy geom */
......@@ -117,10 +118,11 @@ int main(argc,argv)
/* swap_hdr(&hdr2); */
FslWriteHeader(dest);
if(need_to_copy)
FslWriteVolumes(dest, buffer, v);
FslWriteVolumes(dest, buffer, v);
FslClose(dest);
FslClose(src);
/* avw_write_hdr_only(thestring,&hdr2); */
/* }}} */
......
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