/* CreateVMRviaDialog.qs This script is meant to create a VMR project via a user interface.. The script can be run directly via menu > Scripts > CreateVMRviaDialog or via doubleclicking on the function name 'CreateVMRviaDialog()' in the 'Defined Functions' window of the Script Editor. The script does not require manual modifications, because a user interface for the script is provided. Pop-up dialogs will ask for necessary files and values. Hester Breman, Brain Innovation; last update: March 2005 (specification of possible file types: Philips and UFF). */ function CreateVMRviaDialog(){ // *************** CREATE VARIABLES FOR VMR PROJECT *********************** var bvqx = Application.BrainVoyagerQX; var strFileType; var strFirstFile; var longNrOfSlices; var longSwapBytes; var longx_res; var longy_res; var longbyte_per_pixel; // *************** CREATE VMR DIALOG *********************** var paramDialog = new Dialog; paramDialog.title = "Values needed for the creation of a VMR project"; paramDialog.width=400; var rawDataTypeBox = new ComboBox; rawDataTypeBox.label = "Raw data type"; // own filetypes, defined in a *.uff file, can be added to the itemlist and should bear the name of the uff file, f.e. "BRIK" in case the file is called "BRIK.uff" rawDataTypeBox.itemList= ["DICOM", "ANALYZE","SIEMENS","GE_I","GE_MR", "PHILIPS_REC"]; var nrOfSlicesBox = new NumberEdit; nrOfSlicesBox.label = "Nr of slices"; var swapBytesBox = new CheckBox; swapBytesBox.text = "Swap bytes"; swapBytesBox.checked = true; var xResImgBox = new NumberEdit; xResImgBox.label = "x resolution image"; var yResImgBox = new NumberEdit; yResImgBox.label = "y resolution image"; var bytePerPixelBox = new SpinBox; bytePerPixelBox.label = "Bytes per pixel"; bytePerPixelBox.value = 2; paramDialog.add(rawDataTypeBox); paramDialog.add(nrOfSlicesBox); paramDialog.add(swapBytesBox); paramDialog.add(xResImgBox); paramDialog.add(yResImgBox); paramDialog.add(bytePerPixelBox); paramDialog.okButtonText = "OK"; // *************** COLLECT DATA ABOUT VMR PROJECT *********************** MessageBox.information("Please choose the first file of the anatomical series"); strFirstFile = FileDialog.getOpenFileName(); if (paramDialog.exec()) { strFileType = rawDataTypeBox.currentItem; longNrOfSlices = nrOfSlicesBox.value; longSwapBytes = swapBytesBox.checked; longx_res = xResImgBox.value; longy_res = yResImgBox.value; longbyte_per_pixel = bytePerPixelBox.value; } // *************** CREATE THE VMR PROJECT *********************** var docVMR = bvqx.CreateProjectVMR(strFileType, strFirstFile, longNrOfSlices, longSwapBytes, longx_res, longy_res, longbyte_per_pixel); docVMR.Save(); MessageBox.information("End of VMR Project script"); }