
...from: http://developer.apple.com/business/macmarket/neurolens.html
NeuroLens is a faster, more powerful, user-friendlier brain imaging application that owes its existence both to the insight of Rick Hoge, its developer, and to the unique features of the Macintosh platform. A Mac is a powerful and versatile tool in the life sciences—from the UNIX core of Mac OS X and the power of the G5 processor, to the Xcode Tools and the Mac’s native graphics capabilities. It’s a platform that lets researchers focus on their work instead of learning programming and waiting for results.
Many of the previous brain imaging applications used by Rick and his collaborators were written for an earlier generation of computer workstations with performance and memory limitations that are now archaic. Rick and his team saw the opportunity with Mac OS X to develop an imaging application with modern computer performance parameters in mind. “The Apple platform is the largest installed base of any UNIX variant,” Rick explains. “In addition, it is extremely prevalent in the life sciences, and increasing in popularity and in adoptions in neuroimaging labs. It was perfect for what we needed to accomplish.”
The result is NeuroLens, an integrated visualization and analysis package for quantitative physiological neuroimaging, now in public Beta. It is a research imaging tool that is easy to use, intuitive, and has the capabilities to analyze and combine data from many different sources in forms that are extremely useful for researchers. NeuroLens was developed by Hoge at the A. A. Martinos Center for Biomedical Imaging in Charlestown, Mass. Rick is a researcher at Massachusetts General Hospital, a faculty member at the Harvard Medical School, Department of Radiology, whose interests focus on cerebrovascular physiology and the physics of how this affects the signal screen seen in MRI scans. The application is targeted specifically at the research community, who works with large data sets—neurologists, biologists, and neuropsychologists, all doing basic research on brain function. The work is funded by the Office of National Drug Control Policy as part of a project to understand the genetic bases of addiction and depression.
Discovering a Familiar UNIX Environment on Mac OS X “We were using UNIX software systems, and when Mac OS X arrived with its UNIX core, we realized that this was an ideal development opportunity,” Hoge explains.
“Apple has a strong commitment to consumer-oriented systems that are easy to use, and we needed a program that eliminated the need for users to learn advanced UNIX concepts. In addition, many life sciences folks have Macs already, and UNIX was familiar to the developers.”
First, Rick ported their current UNIX code to Mac OS X, which worked easily. The entire imaging team was very happy to have their UNIX applications on the same machine as their word processing and email programs. He adds, “But we saw immediately how outdated our application interfaces were after running these X11 applications side-by-side with Cocoa applications on Mac OS X. While the Mac became our new UNIX workstation, our legacy Unix applications were missing out on the huge performance boost offered by the AltiVec processor, and the advanced user interface refinements available through Cocoa.”
The next logical step then was to design an application that could take advantage of this new platform.
Advantages of Mac OS X Development
It was an easy choice for Rick to chose Mac OS X as the development platform for NeuroLens, a well-engineered, high performance application, using the variety of Mac OS X development tools and performance capabilities, not just its UNIX APIs. Some of the many advantages of developing NeuroLens on the Mac included: ▪ A very refined user interface—NeuroLens was created using the Xcode Tools, especially Interface Builder, with very little work on the part of the developers. ▪ The highly optimized image and signal processing routines that Apple has developed for its successful consumer multimedia products are perfect for the requirements they have in medical imaging performance. ▪ Familiar, trusted UNIX APIs available under the hood, so that previous functionality was not wasted. ▪ Powerful tools like Xcode and Cocoa that made it possible to develop full-powered applications quickly, with a wide range of functionality, without writing a lot of code.
Cocoa Makes Development Easy
“We were extremely impressed with the Mac OS X development tools,” Rick says. “We ran through Cocoa tutorials initially and found them remarkable—in relatively short order I went from having nothing to having a complicated application, with very little effort on my part. I realized then that I could write a complicated imaging application with little work and taking advantage of the extremely fast performance of the OS, as well as its graphics and multimedia capabilities.”
“The appeal of Cocoa for science users is that Objective-C is a simple superset of standard C, and it is easy to drop in or integrate existing C code or algorithms (unlike using Java, which would otherwise be another excellent choice for an imaging application), while also producing a great user interface,” Rick adds. “Interface Builder made it easy to build polished user interfaces, and features like Cocoa bindings made it easy to link the interfaces to program logic.” The integration of old code into the existing Mac OS X development framework is supported by Cocoa, rather than keeping it separated, which results in code that is easier to maintain, and that has a better user interface. “ It’s really all about ease of use,” he summarizes. “We made sure that we used the Apple Human Interface Guidelines when designing the NeuroLens interface, and that was extremely helpful.”
The NeuroLens application is designed such that all processing operations (actions that take one or more datasets read from disk as input to generate a new dataset as output) are implemented as plugins. Plugin bundles for some standard processing operations are included within the application bundle for NeuroLens, and researchers can write their own plugins to extend the functionality of NeuroLens. To make this easy, Hoge wrote a template which, when installed, allows a developer to create a new Xcode project containing a skeletal but fully functional plugin complete with a basic user interface.
Development using Xcode also gives users the ability to get data easily from the program into other documents. Brain images from NeuroLens can be dragged and dropped into Microsoft Word documents, emails, or presentations. Graphs of brain signals can be easily copied and pasted. “Cocoa makes it very easy to go from image display in the visualization environment to export of high quality graphics for presentation,” Rick says. “Because of the deep integration of PDF into the operating system and Cocoa frameworks, it’s very easy to drag a graph from the visualizer into a Keynote presentation as a high-quality vector PDF representation with nice anti-aliased fonts. This was very difficult in older UNIX/X11 apps in which typically we were limited to making a bitmap screen grab of a plot. And all this can be achieved with relatively little developer effort using the standard drag-and-drop/cut-and-paste interface familiar to Mac users.”
By redesigning data structures from scratch based on the memory capacity of modern computers, it was possible to alleviate much of the disk I/O inherent in older applications and also keep more data in contiguous memory—greatly improving cache performance and memory efficiency. This would accelerate performance on any platform, but the additional performance gains afforded by adapting code for linear algebra and DSP functions to use the AltiVec processor—the 128-bit vector processing unit available on G4 and G5 chips that permits math operations to be done in parallel—resulted in an unprecedented level of performance.
NeuroLens Solves Command Line Woes
Much of the imaging software in common use now was first developed in the mid-1990s, by physicists using difficult-to-use UNIX command-line code. The engineering behind that software is now dated, focusing on things like a small memory footprint—performance bottlenecks were completely different than they are with current systems. Today, brain imaging software is being developed primarily by people in the life sciences and psychology, rather than physicists, and the training costs for them to come up to speed on this older software (as they frequently do not have UNIX or programming backgrounds) is quite high.
NeuroLens takes care of these issues. “It can be challenging for a developer or researcher to deal with all the housekeeping associated with file formats and accurate visualization,” Rick says. There is often need to write custom code for data analysis, and the custom Xcode template allows them to do that without having to worry about detailed programming or how the data is arranged on disk or how to display it. With the Xcode template, a grad student who wants to perform a custom processing operation on a dataset can just create a new project in Xcode and immediately gain access to simple data structures. This allows anyone with a reasonable background in programming C to implement their algorithm. Hoge explains, “Such customization provides the developer/researcher with ‘free’ access to multiple complex file formats like DICOM, MINC, as well as Analyze and AFNI, and provides an automatic display of results and the ability to save them to disk.
“We plan to release NeuroLens under an open source license and distribute an Xcode template with it so that users can create custom plug-in models with very little work, specific to their own research needs,” says Hoge.
Better Interoperability with Multiple File Formats
Most older programs were also written for specific labs that used only a few file formats and so tend to be very restrictive about what formats they will support. Rick designed NeuroLens much like [Adobe] Photoshop—it can read many data storage formats and get it into the program. Cocoa provides the architecture to support this—achieving that kind of broad functionality makes NeuroLens very useful in conjunction with other packages, allowing researchers to use NeuroLens’ remarkable imaging capabilities with data sets generated by other applications without having to convert file formats on the command line. “We focused on interoperability,” Rick explains. “In some instances, NeuroLens will be used for its front end to read three dimensional surface images of the brain with another program. In this way, it doesn’t replace other tools, but can be used in conjunction with them. The user interface we developed through Xcode makes the NeuroLens viewing environment much easier to use than our previous generation of software.”
Faster Imaging with NeuroLens
Brain imaging from MRI studies result in a series of three-dimensional images. Image analysis generally consists of image processing steps for data quality improvement, followed by statistical analysis to identify regions of brain activation during a task or stimulus that was applied when the subject was scanned.
“For example,” Rick says, “a series of 3D images must be aligned to reduce the effect of subject motion and are often spatially smoothed in 3D to improve signal-to-noise ratio. Using the improved data structures, AltiVec-based processing routines, and the interactive workflow of Mac OS X, tasks that might have taken half an hour in the past can now be done in seconds. “Because of increases in speed, we can use interfaces that get away from the batch job approach that was required in the past when many operations took overnight.
“This makes the processing more transparent to users—it’s like a Photoshop session where you might do a series of steps on a photo and save the results. At the same time, we use Cocoa’s strong XML support to embed detailed history about acquisition and processing in the output data files.”
The end result is that NeuroLens bridges a large workflow obstacle by allowing a process that was often interrupted for minutes or sometimes hours to be done continuously. This creates a more logical process for researchers, and the performance means that users achieve a new level of interactivity with the work, resulting in more detailed quality assurance than was previously possible with such interrupted workflows. With the new level of interactivity, there is greater ability to spot problems with data that may occur at the time of acquisition (such as scanner spiking or excessive subject movement), and this immediacy allows users to understand the impact of various processing settings much more intuitively than in the past. “This has been a great teaching tool for us,” Rick explains, “as it allows students to get a grasp of the purpose of processing steps and how various parameters affect the end result. It is also very useful not to have to spend several hours or more getting students up to speed on how to use the UNIX command line. Mac OS X allowed us to create an extremely user-friendly and intuitive interface.”
In addition, MRIs can produce both detailed structural and functional information, by showing images of the brain as well as its activity over time. NeuroLens allows researchers to overlay function on top of structure in one image, as well as putting the data into graphs, showing brain response over time. NeuroLens allows researchers to manipulate the basic data set in various ways, using Mac OS X functionality: extracting brain scan images for papers, producing graphs from data analysis of response signals.
For more information on NeuroLens, see the NeuroLens Website at http://www.neurolens.org.