arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

NrroQT.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     6-20-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 /// NrroQT.cpp
00019 ///  simianUI
00020 
00021 #include "NrroQT.h"
00022 #include <qfiledialog.h> 
00023 #include <iostream>
00024 
00025 using namespace std;
00026 
00027 NrroSP openNrroQT(const char *startPath)
00028 {
00029    cerr << "OpenNrroQt" << endl;
00030    //////////////////////////////////
00031    /// The QT file dialog class has a static function
00032    /// just perfect for the task.
00033    QString s;
00034    if(startPath)
00035    {
00036       s = QFileDialog::getOpenFileName(
00037          startPath, 
00038          "Nrrds (*.nrrd *.nrd *.nhdr)");
00039    }
00040    else
00041    {
00042       s = QFileDialog::getOpenFileName(
00043          "/",
00044          "Nrrds (*.nrrd *.nrd *.nhdr)");
00045    }
00046 
00047    //////////////////////////////////
00048    /// If they hit cancel you got a null string back,
00049    /// better check for that.
00050    if(QString::null == s)
00051    {
00052       cerr << " no file name given " << endl;
00053       return 0;
00054    }
00055 
00056    //////////////////////////////////
00057    /// Load the nrrd
00058    NrroSP n(new Nrro(s.ascii()));
00059    if(n->isValid())
00060    {
00061       n->printInfo();
00062    }
00063    else 
00064    {
00065       cerr << " invalid nrrd file " << endl;
00066       return 0;
00067    }
00068    return n;
00069 }

Send questions, comments, and bug reports to:
jmk