ctkDICOMObjectModelTest1.cpp 1.7 KB

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