Skip to content

Commit

Permalink
Merge branch 'release-1.2.4.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
mcvaneede committed Apr 8, 2015
2 parents dfe6cc4 + 24fd03b commit 29970d0
Show file tree
Hide file tree
Showing 21 changed files with 503 additions and 2,660 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: RMINC
Version: 1.2.4.7
Version: 1.2.4.8
Date: 2014-07-29
Title: Package for reading and analyzing MINC2 files
Author: Jason Lerch <jason@mouseimaging.ca>, Jim Nikelski
Expand Down
14 changes: 8 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export( mincIO.getSliceX )
export( mincIO.getSliceY )
export( mincIO.getSliceZ )
export( mincIO.makeNewSliceZ )
export( mincIO.makeNewVolume )
#export( mincIO.makeNewVolume )
export( mincIO.putSlice )
export( mincIO.readBySlice )
export( mincIO.readByVoxel )
Expand Down Expand Up @@ -48,6 +48,7 @@ export( civet.organizeCivetDatFilesMidWhiteGrey )
export( civet.readCivetDatFiles )
export( civet.readAllCivetFiles )
export( civet.CreateBrainViewFile )
export( civet.CreateBrainViewROI )
export( civetFilenames )

#############################
Expand Down Expand Up @@ -117,6 +118,7 @@ export( verboseRun )
export( vertexFDR )
export( vertexLm )
export( vertexAnova )
export( vertexApply )
export( vertexMean )
export( vertexSum )
export( vertexSd )
Expand Down Expand Up @@ -150,17 +152,17 @@ export( mincIO.readMincInfo )

#############################
# mincSlice_class.R
export( mincIO.plotSlicePretty )
#export( mincIO.plotSlicePretty )

#############################
# mincVolumeIO_class.R
export( mincIO.makeNewVolumeX )
export( mincIO.readVolumeX )
export( mincIO.writeVolumeX )
#export( mincIO.makeNewVolumeX )
#export( mincIO.readVolumeX )
#export( mincIO.writeVolumeX )

#############################
# mincVoxelIO_class.R
export( mincIO.readByVoxelX )
#export( mincIO.readByVoxelX )

#############################
# rmincLmeLoop.R
Expand Down
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
New in Version 1.2.4.8
======================
* error checking in mincLm with respect to the mask size and input volume sizes
* minc volumes are properly closed, so there is no limit in the numeber of
minc files that can be opened in a session anymore
* added civet.CreateBrainViewROI, a function that generates ROI files that can
be read by brain-view2
* added anatApply analogous to mincApply/vertexApply
* updated default paths to reflect changes at MICe

New in Version 1.2.4.7
======================
* fixed 2 bugs in anatGetFile: 1) calls the correct program in the "labels" method, and
Expand Down
42 changes: 42 additions & 0 deletions R/civet.R
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,48 @@ else
write.table(roiObj,outputFileName,FALSE,TRUE," ","\n","NA",".",FALSE,FALSE)
}

###########################################################################################
#' @description Create a brainview file of a specific ROI
#' @name civet.CreateBrainViewROI
#' @title civet.CreateBrainViewROI
#' @param atlasFile File with Atlas label (string-label(int)) mappings
#' @param atlasVertices File with vertex label(int) mappings
#' @param region Region to plot -> Must match name in atlas file exactly
#' @param civetVersion Version of CIVET
#' @details Create a .txt file that can be overlaid unto the model template (usually in the CIVET models directory)
#' Currently only CIVET version 1.1.12 is supported.
#' @seealso civet.CreateBrainViewFile
#' @examples
#' getRMINCTestData()
#' civet.CreateBrainViewROI("/tmp/rminctestdata/AAL.csv","/tmp/rminctestdata/AAL_atlas_left.txt","Left Insula")
#' q()
#' (The .txt file is written in the working directory and can be viewed via the command)
#' brain-view2 $CIVET_DIR/models/surf_reg_model_left.obj ./LeftInsula.txt
###########################################################################################
civet.CreateBrainViewROI <- function(atlasFile,atlasVertices,region,civetVersion="1.1.12") {

if ( civetVersion != "1.1.12" ) {
warning(sprintf("This function has not been tested with Civet version %s. Use at your own risk.", civetVersion), immediate.=TRUE)
}

vertices = read.csv(atlasVertices,header=FALSE)
AALAtlas = read.csv(atlasFile)
reducedVertices = vertices[1:40962,1]
roiObj = rep(0,length(reducedVertices))

# Find index of ROI
roiIndex <- which(AALAtlas[,3] == region)

# Match against label
roiLabel <- which(reducedVertices == AALAtlas[roiIndex,1],arr.ind=FALSE)

# Fill in label
roiObj[roiLabel] = 1

# Write out (remove spaces)
write.table(roiObj,gsub(" ","",paste(region,".txt",sep="")),FALSE,TRUE,"","\n","NA",".",FALSE,FALSE)
}

# =============================================================================
#
# Deprecated .. Deprecated .. Deprecated .. Deprecated .. Deprecated ..
Expand Down
Loading

0 comments on commit 29970d0

Please sign in to comment.