ctkDICOMIndexer.cpp

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 // Qt includes
00022 #include <QApplication>
00023 #include <QPushButton>
00024 #include <QTextStream>
00025 
00026 // CTK includes
00027 #include <ctkDICOMIndexer.h>
00028 #include <ctkDICOM.h>
00029 
00030 // STD includes
00031 #include <cstdlib>
00032 #include <iostream>
00033 #include <fstream>
00034 
00035 int main(int argc, char** argv)
00036 {
00037 
00038   if (argc < 2)
00039     {
00040     std::cerr << "Usage: ctkDICOMIndexer <database.db> <sourceDir> [destDir]\n";
00041     return EXIT_FAILURE;
00042     }
00043 
00044   QApplication app(argc, argv);
00045   QTextStream out(stdout);
00046 
00047   ctkDICOMIndexer idx;
00048 
00049   ctkDICOM myCTK;
00050   if ( myCTK.openDatabase( argv[1]) )
00051     {
00052     out << "open db success\n";
00054     myCTK.initializeDatabase();
00055     out << "init db done\n";
00056     if (argc > 3)
00057       {
00058       idx.addDirectory(myCTK.database(),argv[2],argv[3]);
00059       } 
00060       else 
00061       {
00062       idx.addDirectory(myCTK.database(),argv[2]);
00063       }
00064     out << "add db done\n";
00065     idx.refreshDatabase(myCTK.database(),argv[2]);
00066     out << "refresh db done\n";
00067     myCTK.closeDatabase();
00068     }
00069   else
00070     { 
00071     out << "ERROR: " ;
00072     out << myCTK.GetLastError();
00073     out << "\n" ;
00074     }
00075   return EXIT_SUCCESS;
00076 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines