C3D is a command-line tool for converting 3D images between common file formats, which also includes a growing list of commands for image manipulation, such as thresholding and resampling (GPL license, see http://www.itksnap.org/pmwiki/pmwiki.php?n=Downloads.C3D).