From 1a4b973f2cfd974147a10756eb7d2b10ff524ddc Mon Sep 17 00:00:00 2001 From: Frederic Cervenansky Date: Thu, 10 Feb 2011 14:18:05 +0000 Subject: [PATCH] thread bug correction --- src/creaImageIODicomImageReader2.cpp | 2 +- src/creaImageIOGimmickView.cpp | 7 ++++++- src/creaImageIOGimmickView.h | 2 ++ src/creaImageIOUltrasonixImageReader.cpp | 4 ++-- src/creaImageIOWxGimmickReaderDialog.h | 4 ++++ src/creaImageIOWxGimmickView.h | 3 ++- src/creaImageIOWxSimpleDlg.cpp | 3 ++- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/creaImageIODicomImageReader2.cpp b/src/creaImageIODicomImageReader2.cpp index 479170e..53ff687 100644 --- a/src/creaImageIODicomImageReader2.cpp +++ b/src/creaImageIODicomImageReader2.cpp @@ -1,6 +1,6 @@ #include #include "gdcmStringFilter.h" - +#include "vtkGDCMImageReader.h" #include #include "boost/filesystem/path.hpp" diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 6d03b9e..2db53c5 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -296,11 +296,16 @@ namespace creaImageIO mValidationSignal(ivalid); } + void GimmickView::stopReader() + { + mReader.Stop(); + } + //====================================================================== ///Reads Images (Non Threaded) void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vector im, int dimension) { - mReader.Stop(); + stopReader(); /* remember! #define GIMMICK_NO_IMAGE_SELECTION 0 diff --git a/src/creaImageIOGimmickView.h b/src/creaImageIOGimmickView.h index d41ea1a..c34f895 100644 --- a/src/creaImageIOGimmickView.h +++ b/src/creaImageIOGimmickView.h @@ -196,6 +196,8 @@ namespace creaImageIO void readImages(std::vector& o_output, std::vector im, OutputAttr i_attr, int i_dim, double i_zspc); bool isSingle(const std::string i_file); + + void stopReader(); private: diff --git a/src/creaImageIOUltrasonixImageReader.cpp b/src/creaImageIOUltrasonixImageReader.cpp index 978bb03..2b9d783 100644 --- a/src/creaImageIOUltrasonixImageReader.cpp +++ b/src/creaImageIOUltrasonixImageReader.cpp @@ -55,7 +55,7 @@ namespace creaImageIO //===================================================================== bool UltrasonixImageReader::CanRead(const std::string& filename) { - long size; + long size = -1; bool ok = false; FILE *Ultrasonix_file=fopen(filename.c_str(), "rb"); if (Ultrasonix_file) @@ -77,7 +77,7 @@ namespace creaImageIO size = (ftell(Ultrasonix_file) - HEADER_SIZE * sizeof(int)) / sizeof(int); // check if the data size corresponds to the dimensions of the images - if (size == h.width * h.height * h.frame) + if (size == h.width * h.height * h.frame ) ok = true; fclose(Ultrasonix_file); diff --git a/src/creaImageIOWxGimmickReaderDialog.h b/src/creaImageIOWxGimmickReaderDialog.h index e037559..3dff64e 100644 --- a/src/creaImageIOWxGimmickReaderDialog.h +++ b/src/creaImageIOWxGimmickReaderDialog.h @@ -68,6 +68,10 @@ namespace creaImageIO void deleteMessage(); // void OnButtonOk(wxCommandEvent& event); // void OnButtonCancel(wxCommandEvent& event); + void stopReading() + { + mView->stopReader(); + } private : diff --git a/src/creaImageIOWxGimmickView.h b/src/creaImageIOWxGimmickView.h index 6f820f9..dec6809 100644 --- a/src/creaImageIOWxGimmickView.h +++ b/src/creaImageIOWxGimmickView.h @@ -110,7 +110,8 @@ namespace creaImageIO ///Called when there has been a change in the visible attributes of a tree view void OnAttributesChanged(const std::vector& nShown, int level); - + + protected: /// Creates the tool bar void CreateToolBar(); diff --git a/src/creaImageIOWxSimpleDlg.cpp b/src/creaImageIOWxSimpleDlg.cpp index 4b5180a..3b2d906 100644 --- a/src/creaImageIOWxSimpleDlg.cpp +++ b/src/creaImageIOWxSimpleDlg.cpp @@ -113,13 +113,14 @@ namespace creaImageIO dlg.ShowModal(); if (dlg.GetReturnCode() == wxID_OK) { - infoimage=_T("DICOM: ???_EED_???"); + // infoimage=_T("DICOM: ???_EED_???"); //EED 07JUIN2010 dlg.GetSelectedImages(m_results,3); std::vector out; std::vector attr; // attr.push_back("D0028_0010"); // attr.push_back("D0008_0023"); // attr.push_back("D0008_1070"); + dlg.stopReading(); dlg.getSelected(out, attr,true,""); // crea::VtkBasicSlicer(out.front().img); m_results.clear(); -- 2.47.1