/* --------------------------------------------- */ static void dump_options(FILE *fp) { fprintf(fp,"\n"); fprintf(fp,"%s\n",vcid); fprintf(fp,"%s\n",Progname); fprintf(fp,"FREESURFER_HOME %s\n",getenv("FREESURFER_HOME")); fprintf(fp,"SUBJECTS_DIR %s\n",getenv("SUBJECTS_DIR")); if (SUBJECTS_DIR1) fprintf(fp,"SUBJECTS_DIR1 %s\n",SUBJECTS_DIR1); if (SUBJECTS_DIR2) fprintf(fp,"SUBJECTS_DIR2 %s\n",SUBJECTS_DIR2); fprintf(fp, "cwd %s\n",cwd); fprintf(fp, "cmdline %s\n",cmdline); fprintf(fp, "timestamp %s\n",VERcurTimeStamp()); fprintf(fp, "sysname %s\n",uts.sysname); fprintf(fp, "hostname %s\n",uts.nodename); fprintf(fp, "machine %s\n",uts.machine); fprintf(fp, "user %s\n",VERuser()); fprintf(fp, "surf1path %s\n",surf1path); fprintf(fp, "surf2path %s\n",surf2path); if (subject1) fprintf(fp,"subject1 %s\n",subject1); if (subject2) fprintf(fp,"subject2 %s\n",subject2); if (hemi) fprintf(fp,"hemi %s\n",hemi); if (surfname) fprintf(fp,"surfname %s\n",surfname); if (curvname) fprintf(fp,"curvname %s\n",curvname); if (aparcname)fprintf(fp,"aparcname %s\n",aparcname); if (aparc2name)fprintf(fp,"aparc2name %s\n",aparc2name); fprintf(fp,"\n"); fprintf(fp,"\n"); return; }
/* ------ Doxygen markup ends on the line above (this line not needed for Doxygen) -- */ static void dump_options(FILE *fp) { fprintf(fp,"\n"); fprintf(fp,"%s\n",vcid); fprintf(fp,"cwd %s\n",cwd); fprintf(fp,"cmdline %s\n",cmdline); fprintf(fp,"sysname %s\n",uts.sysname); fprintf(fp,"hostname %s\n",uts.nodename); fprintf(fp,"machine %s\n",uts.machine); fprintf(fp,"user %s\n",VERuser()); return; }
/*--------------------------------------------------------------*/ static void dump_options(FILE *fp) { fprintf(fp,"\n"); fprintf(fp,"%s\n",vcid); fprintf(fp,"cwd %s\n",cwd); fprintf(fp,"cmdline %s\n",cmdline); fprintf(fp,"sysname %s\n",uts.sysname); fprintf(fp,"hostname %s\n",uts.nodename); fprintf(fp,"machine %s\n",uts.machine); fprintf(fp,"user %s\n",VERuser()); fprintf(fp,"srcvalfile %s\n",SrcValFile); fprintf(fp,"trgvalfile %s\n",TrgValFile); fprintf(fp,"nsurfs %d\n",nsurfs); fprintf(fp,"jac %d\n",DoJac); fprintf(fp,"revmap %d\n",ReverseMapFlag); return; }
/* --------------------------------------------- */ static void dump_options(FILE *fp) { fprintf(fp,"\n"); fprintf(fp,"%s\n",vcid); fprintf(fp,"%s\n",Progname); fprintf(fp,"FREESURFER_HOME %s\n",getenv("FREESURFER_HOME")); fprintf(fp,"cwd %s\n",cwd); fprintf(fp,"cmdline %s\n",cmdline); fprintf(fp,"timestamp %s\n",VERcurTimeStamp()); fprintf(fp,"sysname %s\n",uts.sysname); fprintf(fp,"hostname %s\n",uts.nodename); fprintf(fp,"machine %s\n",uts.machine); fprintf(fp,"user %s\n",VERuser()); fprintf(fp,"input %s\n",inpath); fprintf(fp,"synth %d\n",synth); if (Xfile) fprintf(fp,"xfile %s\n",Xfile); if (DetrendOrder >= 0) fprintf(fp,"detrend %d\n",DetrendOrder); fprintf(fp,"infwhm %lf\n",infwhm); fprintf(fp,"ingstd %lf\n",ingstd); fprintf(fp,"tofwhm %lf\n",tofwhm); if (tofwhm > 0) { fprintf(fp,"byfwhm-tofwhm %lf\n",byfwhm); fprintf(fp,"tofwhm-tol %lf\n",tofwhmtol); fprintf(fp,"tofwhm-niters %d\n",tofwhmniters); fprintf(fp,"tofwhm-niters-max %d\n",tofwhmnitersmax); } if (maskpath) fprintf(fp,"mask %s\n",maskpath); if (automask) fprintf(fp,"automaskthresh %g\n",automaskthresh); if (mask) { fprintf(fp,"maskthresh %g\n",maskthresh); fprintf(fp,"maskinv %d\n",maskinv); fprintf(fp,"nerode %d\n",nerode); } if (outmaskpath) { fprintf(fp,"outmask %s\n",outmaskpath); fprintf(fp,"SaveDetrended %d\n",SaveDetrended); fprintf(fp,"SaveUnmasked %d\n",SaveUnmasked); } if (synth) { fprintf(fp,"synth-frames %d\n",nframes); fprintf(fp,"seed %d\n",SynthSeed); } if (outpath) fprintf(fp,"out %s\n",outpath); return; }
/* --------------------------------------------- */ static void dump_options(FILE *fp) { fprintf(fp,"\n"); fprintf(fp,"%s\n",vcid); fprintf(fp,"cwd %s\n",cwd); fprintf(fp,"cmdline %s\n",cmdline); fprintf(fp,"sysname %s\n",uts.sysname); fprintf(fp,"hostname %s\n",uts.nodename); fprintf(fp,"machine %s\n",uts.machine); fprintf(fp,"user %s\n",VERuser()); fprintf(fp,"OutTop %s\n",OutTop); fprintf(fp,"CSDBase %s\n",csdbase); fprintf(fp,"nreps %d\n",nRepetitions); fprintf(fp,"subject %s\n",subject); fprintf(fp,"hemi %s\n",hemi); if(MaskFile) fprintf(fp,"mask %s\n",MaskFile); fprintf(fp,"UseAvgVtxArea %d\n",UseAvgVtxArea); fprintf(fp,"SaveFile %s\n",SaveFile); fprintf(fp,"StopFile %s\n",StopFile); fflush(fp); return; }
/* --------------------------------------------- */ static void dump_options(FILE *fp) { fprintf(fp,"\n"); fprintf(fp,"%s\n",vcid); fprintf(fp,"cwd %s\n",cwd); fprintf(fp,"cmdline %s\n",cmdline); fprintf(fp,"sysname %s\n",uts.sysname); fprintf(fp,"hostname %s\n",uts.nodename); fprintf(fp,"machine %s\n",uts.machine); fprintf(fp,"user %s\n",VERuser()); fprintf(fp,"\n"); fprintf(fp,"subject %s\n",subject); fprintf(fp,"hemi %s\n",hemi); fprintf(fp,"SUBJECTS_DIR %s\n",SUBJECTS_DIR); fprintf(fp,"ColorTable %s\n",CTabFile); if(AnnotName) fprintf(fp,"AnnotName %s\n",AnnotName); if(AnnotPath) fprintf(fp,"AnnotPath %s\n",AnnotPath); if (NHitsFile) fprintf(fp,"NHitsFile %s\n",NHitsFile); fprintf(fp,"nlables %d\n",nlabels); fprintf(fp,"LabelThresh %d %lf\n",DoLabelThresh,LabelThresh); return; }
/*---------------------------------------------------------------*/ int main(int argc, char **argv) { SDCMFILEINFO **sdfi_list; SDCMFILEINFO *sdfi=NULL; int nlist; int NRuns; int nthfile; char *fname, *psname, *protoname; int PrevRunNo; Progname = argv[0] ; argc --; argv++; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; if (argc == 0) usage_exit(); cmdline = argv2cmdline(argc,argv); parse_commandline(argc, argv); check_options(); uname(&uts); getcwd(cwd,2000); fprintf(stdout,"%s\n",vcid); fprintf(stdout,"cwd %s\n",cwd); fprintf(stdout,"cmdline %s\n",cmdline); fprintf(stdout,"sysname %s\n",uts.sysname); fprintf(stdout,"hostname %s\n",uts.nodename); fprintf(stdout,"machine %s\n",uts.machine); fprintf(stdout,"user %s\n",VERuser()); strip_leading_slashes(sdicomdir); /* open the output file, or set output stream to stdout */ if (outfile != NULL) { outstream = fopen(outfile,"w"); if (outstream == NULL) { fprintf(stderr,"ERROR: could not open %s for writing\n",outfile); exit(1); } } else outstream = stdout; /* Get all the Siemens DICOM files from this directory */ fprintf(stderr,"INFO: scanning path to Siemens DICOM DIR:\n %s\n", sdicomdir); sdfi_list = ScanSiemensDCMDir(sdicomdir, &nlist); if (sdfi_list == NULL) { fprintf(stderr,"ERROR: scanning directory %s\n",sdicomdir); exit(1); } printf("INFO: found %d Siemens files\n",nlist); printf("%s\n",sdfi_list[0]->NumarisVer); tmpstring = sdcmExtractNumarisVer(sdfi_list[0]->NumarisVer, &Maj, &Min, &MinMin); if (tmpstring == NULL) free(tmpstring); else { if ((Min == 1 && MinMin <= 6) && Maj < 4) { // This should only be run for pretty old data. I've lost // track as to which versions should do this. With Maj<4, // I'm pretty sure that this section of code will never // be run. It might need to be run with version 4VA16 // and earlier. Note: this same code is in DICOMRead.c printf("Computing TR with number of slices\n"); TRSlice = 1; } } /* Sort the files by Series, Slice Position, and Image Number */ printf("Sorting\n"); fflush(stdout); fflush(stderr); SortSDCMFileInfo(sdfi_list,nlist); /* Assign run numbers to each file (count number of runs)*/ if (sortbyrun) { fprintf(stderr,"Assigning Run Numbers\n"); fflush(stderr); NRuns = sdfiAssignRunNo2(sdfi_list, nlist); if (NRuns == 0) { fprintf(stderr,"ERROR: sorting runs\n"); fflush(stderr); exit(1); } } PrevRunNo = -1; for (nthfile = 0; nthfile < nlist; nthfile++) { sdfi = sdfi_list[nthfile]; if (summarize && PrevRunNo == sdfi->RunNo) continue; PrevRunNo = sdfi->RunNo; sdfi->RepetitionTime /= 1000.0; // Old version of Siemens software had reptime as time between // slices. New has reptime as time between volumes. // Code (above) looks at version and does the right thing. if (sdfi->IsMosaic && TRSlice) sdfi->RepetitionTime *= sdfi->VolDim[2]; fname = fio_basename(sdfi->FileName,NULL); psname = strip_white_space(sdfi->PulseSequence); protoname = strip_white_space(sdfi->ProtocolName); fprintf(outstream, "%4d %s %3d %d %4d %d %3d %3d %3d %3d %8.4f %8.4f %s\n", nthfile+1, fname, sdfi->SeriesNo, sdfi->ErrorFlag, sdfi->ImageNo, sdfi->IsMosaic, sdfi->VolDim[0], sdfi->VolDim[1], sdfi->VolDim[2], sdfi->NFrames, sdfi->RepetitionTime, sdfi->EchoTime, protoname); fflush(outstream); free(fname); free(psname); free(protoname); } while (nlist--) { // free strings free(sdfi_list[nlist]->FileName); free(sdfi_list[nlist]->StudyDate); free(sdfi_list[nlist]->StudyTime); free(sdfi_list[nlist]->PatientName); free(sdfi_list[nlist]->SeriesTime); free(sdfi_list[nlist]->AcquisitionTime); free(sdfi_list[nlist]->ScannerModel); free(sdfi_list[nlist]->NumarisVer); free(sdfi_list[nlist]->PulseSequence); free(sdfi_list[nlist]->ProtocolName); free(sdfi_list[nlist]->PhEncDir); // free(sdfi_list[nlist]); } free(sdfi_list); if (outfile != NULL) fclose(outstream); fflush(stdout); fflush(stderr); exit(0); return(0); }