1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
imagePath <- "/share/work/data/brainweb" ;
binPath <- "/share/bin-linux/insight/bin" ;
validationRoot <- "/share/work/src/Insight/Validation/StatisticalClustering" ;
scriptPath <- getwd() ;
iteration <- 4000 ;
parametersMutationScales <- c(1, 2) ;
noiseLevels = c(3, 9) ;
imageSets <- list() ;
imageSets[[1]] <- c("brainweb.T1.1mm.3.0.mhd",
"brainweb.PD.1mm.3.0.mhd") ;
imageSets[[2]] <- c("brainweb.T1.1mm.9.0.mhd",
"brainweb.PD.1mm.9.0.mhd") ;
classMask <- "phantom_discrete.mhd" ;
kdTreeBucketSize = 100 ;
for ( i in 1:length(noiseLevels) )
{
for ( j in 1:length(parametersMutationScales) )
{
# prepare common command arguments for EM & GOF
imageFiles <- paste(imagePath, "/", imageSets[[i]], sep="") ;
paramFile <- paste(validationRoot, "/Inputs/BrainWeb/", noiseLevels[i], "pn.params.",
parametersMutationScales[j], "ext.dat", sep="") ;
maskFile <- paste(imagePath, "/", classMask, sep="") ;
options.files <- "--images" ;
for ( k in 1:length(imageFiles) )
{
options.files <- paste(options.files, imageFiles[k]) ;
}
options.maskfile <- paste("--mask", maskFile) ;
options.parameters <- paste("--parameters", paramFile) ;
options.iteration <- paste("--iteration", iteration) ;
# prepare the command arguments for EM
resultfile <- paste(validationRoot, "/Results/BrainWeb2.EM.", noiseLevels[i], "pn.",
parametersMutationScales[j], "ext.dat", sep="") ;
options.resultfile <- paste("--result", resultfile) ;
options <- paste(options.files, options.maskfile,
options.parameters,
options.resultfile,
options.iteration) ;
#run EM experiment
command <- paste(binPath, "/ExpectationMaximizationBrainWebValidationApp", sep="") ;
command <- paste(command, options) ;
if ( file.access(resultfile, mode=0) == -1 )
{
print(command) ;
system(command) ;
}
# prepare the command arguments for Kmeans
resultfile <- paste(validationRoot, "/Results/BrainWeb2.Kmeans.", noiseLevels[i], "pn.",
parametersMutationScales[j], "ext.dat", sep="") ;
options.resultfile <- paste("--result", resultfile) ;
options.bucketsize <- paste("--bucket-size", kdTreeBucketSize) ;
options <- paste(options.files, options.maskfile,
options.parameters, options.resultfile,
options.iteration, options.bucketsize) ;
#run GOF experiment
command <- paste(binPath, "/KdTreeBasedKmeansBrainWebValidationApp", sep="") ;
command <- paste(command, options) ;
if ( file.access(resultfile, mode=0) == -1 )
{
print(command) ;
system(command) ;
}
}
}
|