ctkDICOMObjectModelTest1.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*==========================================================================
  2. Library: CTK
  3. Copyright (c) Brigham and Women's Hospital (BWH).
  4. Copyright (c) University of Sheffield.
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==========================================================================*/
  15. // STD includes
  16. #include <iostream>
  17. #include <algorithm>
  18. // Qt includes
  19. #include <QApplication>
  20. #include <QFileDialog>
  21. #include <QHeaderView>
  22. #include <QString>
  23. #include <QTimer>
  24. #include <QTreeView>
  25. // CTK Core
  26. #include "ctkDICOMObjectModel.h"
  27. int ctkDICOMObjectModelTest1( int argc, char * argv [] )
  28. {
  29. QApplication app(argc, argv);
  30. QString fileName;
  31. //TODO: Add the option for reading the test file from argv
  32. fileName = QFileDialog::getOpenFileName( 0,
  33. "Choose a DCM File", ".","DCM (*)" );
  34. ctkDICOMObjectModel dcmObjModel;
  35. dcmObjModel.setFile(fileName);
  36. QTreeView *viewer = new QTreeView();
  37. viewer->setModel( &dcmObjModel);
  38. viewer->expandAll();
  39. viewer->resizeColumnToContents(0);
  40. viewer->resizeColumnToContents(1);
  41. viewer->resizeColumnToContents(2);
  42. viewer->resizeColumnToContents(3);
  43. viewer->resizeColumnToContents(4);
  44. //viewer->header()->setResizeMode( QHeaderView::Stretch);
  45. viewer->show();
  46. viewer->raise();
  47. return app.exec();
  48. }