From: Eduardo DAVILA Date: Tue, 7 Aug 2018 14:11:56 +0000 (+0200) Subject: #3218 creaImageIO Feature New Normal - vtk8itk4wx3-mingw64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=98e1f28f00373ed1119229eb1b4cd7bf45b44613;hp=f6c90a7f05ae0fd545dfdba5cd5a37d124bd8056;p=creaImageIO.git #3218 creaImageIO Feature New Normal - vtk8itk4wx3-mingw64 --- diff --git a/appli/TestWxGimmickReaderDialog/CMakeLists.txt b/appli/TestWxGimmickReaderDialog/CMakeLists.txt index fa7307b..66a1fb1 100644 --- a/appli/TestWxGimmickReaderDialog/CMakeLists.txt +++ b/appli/TestWxGimmickReaderDialog/CMakeLists.txt @@ -25,11 +25,17 @@ IF(WIN32) ADD_EXECUTABLE(creaImageIOApp WIN32 main) - SET_TARGET_PROPERTIES(creaImageIOApp PROPERTIES LINK_FLAGS /subsystem:console ) + + IF(MINGW) + SET_TARGET_PROPERTIES(creaImageIOApp PROPERTIES LINK_FLAGS -mconsole ) + ELSE(MINGW) + SET_TARGET_PROPERTIES(creaImageIOApp PROPERTIES LINK_FLAGS /subsystem:console ) + ENDIF(MINGW) + ELSE(WIN32) ADD_EXECUTABLE(creaImageIOApp MACOSX_BUNDLE main) ENDIF(WIN32) -TARGET_LINK_LIBRARIES( creaImageIOApp creaImageIO ) +TARGET_LINK_LIBRARIES( creaImageIOApp creaImageIO ${ITK_LIBRARIES} ) INSTALL_TARGETS(/bin/ creaImageIOApp ) diff --git a/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h b/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h index 3b98bfd..d099ff2 100644 --- a/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h +++ b/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h @@ -32,11 +32,11 @@ class bbcreaImageIO_EXPORT GetDicomAttributesFromMaps BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetDicomAttributesFromMaps,bbtk::AtomicBlackBox); BBTK_NAME("GetDicomAttributesFromMaps"); -BBTK_AUTHOR("Info-Dev, Eduardo DAVIL"); +BBTK_AUTHOR("Info-Dev, Eduardo DAVILA"); BBTK_DESCRIPTION("eduardo.davila[at]creatis.insa-lyon.fr -"); BBTK_CATEGORY("empty"); BBTK_INPUT(GetDicomAttributesFromMaps,In,"Vector of maps with DICOM attributes",std::vector< mapString >,""); - BBTK_INPUT(GetDicomAttributesFromMaps,KeyDicom,"Key DICOM",std::string ,""); + BBTK_INPUT(GetDicomAttributesFromMaps,KeyDicom,"Key DICOM ex: D0028_0030 ",std::string ,""); BBTK_OUTPUT(GetDicomAttributesFromMaps,Out,"Vector of the attribute asked.",std::vector ,""); BBTK_END_DESCRIBE_BLACK_BOX(GetDicomAttributesFromMaps); //===== diff --git a/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.cxx b/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.cxx index b3b8552..e0c2a1e 100644 --- a/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.cxx +++ b/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.cxx @@ -1,28 +1,28 @@ /* - # --------------------------------------------------------------------- - # - # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image - # pour la Santé) - # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton - # Previous Authors : Laurent Guigues, Jean-Pierre Roux - # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil - # - # This software is governed by the CeCILL-B license under French law and - # abiding by the rules of distribution of free software. You can use, - # modify and/ or redistribute the software under the terms of the CeCILL-B - # license as circulated by CEA, CNRS and INRIA at the following URL - # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - # or in the file LICENSE.txt. - # - # As a counterpart to the access to the source code and rights to copy, - # modify and redistribute granted by the license, users are provided only - # with a limited warranty and the software's author, the holder of the - # economic rights, and the successive licensors have only limited - # liability. - # - # The fact that you are presently reading this means that you have had - # knowledge of the CeCILL-B license and that you accept its terms. - # ------------------------------------------------------------------------ + # --------------------------------------------------------------------- + # + # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image + # pour la Santé) + # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton + # Previous Authors : Laurent Guigues, Jean-Pierre Roux + # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil + # + # This software is governed by the CeCILL-B license under French law and + # abiding by the rules of distribution of free software. You can use, + # modify and/ or redistribute the software under the terms of the CeCILL-B + # license as circulated by CEA, CNRS and INRIA at the following URL + # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + # or in the file LICENSE.txt. + # + # As a counterpart to the access to the source code and rights to copy, + # modify and redistribute granted by the license, users are provided only + # with a limited warranty and the software's author, the holder of the + # economic rights, and the successive licensors have only limited + # liability. + # + # The fact that you are presently reading this means that you have had + # knowledge of the CeCILL-B license and that you accept its terms. + # ------------------------------------------------------------------------ */ //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) @@ -31,6 +31,32 @@ #include "bbcreaImageIOItkImagesChooserDialogBox.h" #include "bbcreaImageIOPackage.h" +#include "itkImage.h" +#include "itkImportImageFilter.h" + +/* +// ------------------------------------------------------------------------- +// LFV: avoid itk::Concept check on 4d or superior images +#define BBCREAIMAGEIO_ChooserDlg_Template( t, ty, di ) \ + if( t == typeid( itk::Image< ty, di >* ) ) \ + { \ + this->Export< itk::Image< ty, di > >( ); \ + this->ExportVTK< itk::Image< ty, di > >( ); \ + } +*/ + +// ------------------------------------------------------------------------- +// LFV: avoid itk::Concept check on 4d or superior images +#define BBCREAIMAGEIO_ChooserDlg_Template( t, ty, di ) \ + if( t == typeid( itk::Image< ty, di >* ) ) \ + { \ + this->Export< ty , di >( ); \ + this->ExportVTK< itk::Image< ty, di > >( ); \ + } + + +// ------------------------------------------------------------------------- + namespace bbcreaImageIO { @@ -46,47 +72,115 @@ void ItkImagesChooserDialogBox::Process() dlg->ShowModal(); bbtk::TypeInfo typ = bbitk::GetITKImagePtrTypeInfoFromPixelTypeInfoAndDimension(*dlg->getTypes().front(), dlg->getDims().front()); - BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, Export); - BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, ExportVTK); + + BBCREAIMAGEIO_ChooserDlg_Template( typ, char, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, short, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, int, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, long, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, float, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, double, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned char, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned short, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned int, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned long, 1 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, char, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, short, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, int, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, long, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, float, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, double, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned char, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned short, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned int, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned long, 2 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, char, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, short, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, int, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, long, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, float, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, double, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned char, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned short, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned int, 3 ) + else BBCREAIMAGEIO_ChooserDlg_Template( typ, unsigned long, 3 ); + + + /* Deprecated + BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, Export); + BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, ExportVTK); + */ delete dlg; } -template + +//template +template void ItkImagesChooserDialogBox::Export() { - if (dlg->getImagesSelected().size() == 1) - { + typedef itk::Image TImage; + if (dlg->getImagesSelected().size() == 1) + { bbSetOutputOut( dlg->getTemplatedImagesSelected().front().GetPointer() ); - } - else if (dlg->getImagesSelected().size() > 1) - { - OutputImagesITKType outVect; - - typename std::vector tempImgs= dlg->getTemplatedImagesSelected(); - typename std::vector::iterator it = tempImgs.begin(); - for(;it != tempImgs.end(); ++it) - { - outVect.push_back( (*it).GetPointer() ); - } - bbSetOutputOutIImages( outVect); - } - else - { + } else if (dlg->getImagesSelected().size() > 1){ + OutputImagesITKType outVect; + typename std::vector tempImgs= dlg->getTemplatedImagesSelected(); + typename std::vector::iterator it = tempImgs.begin(); + for(;it != tempImgs.end(); ++it) + { + outVect.push_back( (*it).GetPointer() ); + } // for + bbSetOutputOutIImages( outVect); + + typedef ty RGBPixelType; + typedef itk::ImportImageFilter< ty , di > ImportFilterType; + typename ImportFilterType::Pointer importFilter = ImportFilterType::New(); + + typename TImage::SizeType imsize; + imsize[0] = tempImgs[0].GetPointer()->GetLargestPossibleRegion().GetSize()[0]; + imsize[1] = tempImgs[0].GetPointer()->GetLargestPossibleRegion().GetSize()[1]; + imsize[2] = tempImgs.size(); + + typename ImportFilterType::IndexType start; + start.Fill( 0 ); + typename ImportFilterType::RegionType region; + region.SetIndex( start ); + region.SetSize( imsize ); + importFilter->SetRegion( region ); + + const itk::SpacePrecisionType origin[ 3 ] = { 0.0, 0.0, 0.0 }; + importFilter->SetOrigin( origin ); + + const itk::SpacePrecisionType spacing[ 3 ] = { 1.0, 1.0, 1.0 }; + importFilter->SetSpacing( spacing ); + const unsigned long int numberOfPixels2D = imsize[0]*imsize[1]; + const unsigned long int numberOfPixels2DInBytes = imsize[0]*imsize[1]*sizeof(ty); + const unsigned long int numberOfPixels3D = imsize[0]*imsize[1]*imsize[2]*sizeof(ty); + + RGBPixelType * localBuffer = new RGBPixelType[ numberOfPixels3D ]; + RGBPixelType * tmpLocalBuffer = localBuffer; + + it = tempImgs.begin(); + for(;it != tempImgs.end(); ++it) + { + memcpy(tmpLocalBuffer, (*it).GetPointer()->GetBufferPointer(), numberOfPixels2DInBytes); + tmpLocalBuffer = tmpLocalBuffer + numberOfPixels2D; + } // for + + const bool importImageFilterWillOwnTheBuffer = true; + importFilter->SetImportPointer( localBuffer , numberOfPixels3D , importImageFilterWillOwnTheBuffer ); + importFilter->Update(); + importFilter->Register(); + bbSetOutputOut( importFilter->GetOutput() ); + + } else { // warning: passing NULL to non-pointer //bbSetOutputOut( NULL); bbSetOutputOut(0); // JPR } - // FCY To test the Output - //typedef itk::Image ImageType; - //typedef itk::ImageFileReader< ImageType > itkReaderType; - // typename itkReaderType::Pointer reader = itkReaderType::New(); - // - // reader->SetFileName("d:\test.hdr"); - // reader->Update(); - //reader->GetOutput()->Register(); - // this->bbSetOutputOut(reader->GetOutput()); } + + template void ItkImagesChooserDialogBox::ExportVTK() { @@ -100,40 +194,34 @@ void ItkImagesChooserDialogBox::ExportVTK() dlg->split3Din3Dvtk( (*it) ); } bbSetOutputOutVImages( dlg->getVtkImagesSelected() ); - } - else if (dlg->getDims().front() == 4) - { + } else if (dlg->getDims().front() == 4) { // To Test // dlg->split4Din3Dvtk("d:/temp2"); // bbSetOutputOutVImages( dlg->getVtkImagesSelected()); - } - else - { - // NOT IMPLEMENTED YET FOR DIMENSIONS > 4 - - } - + } else { + // NOT IMPLEMENTED YET FOR DIMENSIONS > 4 + } // if dlg } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ItkImagesChooserDialogBox::bbUserSetDefaultValues() -{ - +{ } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ItkImagesChooserDialogBox::bbUserInitializeProcessing() { - } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ItkImagesChooserDialogBox::bbUserFinalizeProcessing() { - } -} -// EO namespace bbcreaImageIO + +} // EO namespace bbcreaImageIO diff --git a/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.h b/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.h index fa1d910..b492390 100644 --- a/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.h +++ b/bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.h @@ -75,7 +75,9 @@ class bbcreaImageIO_EXPORT ItkImagesChooserDialogBox private: // Template read method - template void Export(); + +//EED template void Export(); +template void Export(); // Template export vtk Images template void ExportVTK(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c8726b7..2f188a3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -285,6 +285,10 @@ ENDIF(USE_WXWIDGETS) IF (NOT USE_XERCES) + +message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") +message(${VTK_LIBRARIES}) + TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${crea_LIBRARIES} ${creaBruker_LIBRARIES} diff --git a/src/creaImageIOGimmick.cpp b/src/creaImageIOGimmick.cpp index 5b01f74..7ba9b2a 100644 --- a/src/creaImageIOGimmick.cpp +++ b/src/creaImageIOGimmick.cpp @@ -202,10 +202,10 @@ namespace creaImageIO { if (mHomeDirectory.size()==0) { -#if defined(__GNUC__) - mHomeDirectory = getenv("HOME"); -#elif defined(_WIN32) +#if defined(_WIN32) mHomeDirectory = getenv("USERPROFILE"); +#elif defined(__GNUC__) + mHomeDirectory = getenv("HOME"); #endif } return mHomeDirectory; diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 672f922..0a0dd0c 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -36,8 +36,11 @@ #include #include #include + #endif +#include + /*#if defined(USE_GDCM2) #include #include "gdcmSystem.h" @@ -376,11 +379,14 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect // n*2D to 3D vtkImageData* out = vtkImageData::New(); // out->CopyStructure(first); - out->SetScalarType(first->GetScalarType()); - out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; //first->GetExtent(ext); // JPR +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // renvoie egalement 0,0 en Z // JPR +#else + first->GetExtent(ext); // renvoie egalement 0,0 en Z // JPR +#endif if(ext[5] == 0) { @@ -396,10 +402,17 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect int dim[3]; first->GetDimensions(dim); - out->SetDimensions(dim[0], dim[1], (int)im.size() ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out->SetScalarType(first->GetScalarType()); + out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out->AllocateScalars(); out->Update(); +#else + out->AllocateScalars(first->GetScalarType(),first->GetNumberOfScalarComponents()); +#endif unsigned long imsize = dim[0] * dim[1]; imsize = imsize * dim[2] ; // deal with multiframes // JPR @@ -486,9 +499,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect void GimmickView::readImages1(std::vector& o_output, std::vector im, OutputAttr i_attr) { - i_attr.outside.push_back("D0019_100a"); // simens Number Of Images In Mosaic - std::vector::iterator it; for (it=im.begin(); it!=im.end(); ++it) { @@ -518,10 +529,13 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect OutStrGimmick out; vtkImageData* first = mReader.GetImage( im.front()); out.img = vtkImageData::New(); - out.img->SetScalarType(first->GetScalarType()); - out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // send also 0,0 in Z +#else + first->GetExtent(ext); // send also 0,0 in Z +#endif if(ext[5] == 0) { ext[5] = (int)im.size()-1; @@ -535,8 +549,20 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect first->GetSpacing(spac); out.img->SetSpacing(spac); out.img->SetDimensions(dim[0], dim[1], (int)im.size() ); + + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out.img->SetScalarType(first->GetScalarType()); + out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out.img->AllocateScalars(); out.img->Update(); +#else + out.img->AllocateScalars(first->GetScalarType(), first->GetNumberOfScalarComponents()); +#endif + + unsigned long imsize = dim[0] * dim[1]; imsize = imsize * dim[2] ; // deal with multiframes here // differents formats char , short, etc... @@ -552,6 +578,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect memcpy(out.img->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize); slice++; } + getAttributes(im.front(),out.infos, i_attr); o_output.push_back(out); } @@ -585,17 +612,29 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect { OutStrGimmick out; out.img = vtkImageData::New(); - out.img->SetScalarType(first->GetScalarType()); out.img->SetSpacing(spac); - out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // send also 0,0 in Z +#else + first->GetExtent(ext); // send also 0,0 in Z +#endif ext[5] = 0; out.img->SetExtent(ext); - out.img->SetDimensions(dim[0], dim[1], 1 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out.img->SetScalarType(first->GetScalarType()); + out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out.img->AllocateScalars(); out.img->Update(); +#else + out.img->AllocateScalars(first->GetScalarType(),first->GetNumberOfScalarComponents()); +#endif + + memcpy(out.img->GetScalarPointer(0,0,0), cur->GetScalarPointer(0,0,slice), imsize); o_output.push_back(out); } @@ -625,19 +664,33 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect { OutStrGimmick out; out.img = vtkImageData::New(); - out.img->SetScalarType(first->GetScalarType()); - out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; - double spac[6]; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // send also 0,0 in Z +#else + first->GetExtent(ext); // send also 0,0 in Z +#endif + + double spac[6]; ext[5] = 0; out.img->SetExtent(ext); first->GetSpacing(spac); out.img->SetSpacing(spac); out.img->SetDimensions(dim[0], dim[1], (int)im.size() ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out.img->SetScalarType(first->GetScalarType()); + out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out.img->AllocateScalars(); out.img->Update(); +#else + out.img->AllocateScalars(first->GetScalarType(), first->GetNumberOfScalarComponents()); +#endif + unsigned long imsize = dim[0] * dim[1]; imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents(); int index = 0; diff --git a/src/creaImageIOImageReader.cpp b/src/creaImageIOImageReader.cpp index 4220fb1..cdb6cb5 100644 --- a/src/creaImageIOImageReader.cpp +++ b/src/creaImageIOImageReader.cpp @@ -78,8 +78,15 @@ namespace creaImageIO dim[0] = dim[1] = 128; dim[2] = 1; mUnreadableImage->SetDimensions ( dim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 mUnreadableImage->SetScalarTypeToUnsignedChar(); - mUnreadableImage->AllocateScalars(); + mUnreadableImage->AllocateScalars(); +#else + mUnreadableImage->AllocateScalars(VTK_UNSIGNED_CHAR,1); +#endif + for (int i=0;iSetScalarComponentFromFloat(i,j,0,0,0); diff --git a/src/creaImageIOMultiThreadImageReader.cpp b/src/creaImageIOMultiThreadImageReader.cpp index c4056b0..1679136 100644 --- a/src/creaImageIOMultiThreadImageReader.cpp +++ b/src/creaImageIOMultiThreadImageReader.cpp @@ -119,7 +119,6 @@ namespace creaImageIO //===================================================================== bool MultiThreadImageReader::Start() { - // std::cout << "#### MultiThreadImageReader::Start()" // < 0) return true; @@ -463,7 +462,9 @@ namespace creaImageIO // std::cout << "user="<GetUser() <GetUser() == this ) + { GetMultiThreadImageReaderUserMutex().Unlock(); + } p->GetUser()->MultiThreadImageReaderSendEvent (p->GetFilename(), @@ -480,9 +481,22 @@ namespace creaImageIO // wxMutexLocker lock(GetMultiThreadImageReaderUserMutex()); mUnloadQueue.insert(p); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 p->GetImage()->UpdateInformation(); p->GetImage()->PropagateUpdateExtent(); long ImMem = p->GetImage()->GetEstimatedMemorySize(); +#else + int ext[6]; + int dim[3]; + p->GetImage()->GetExtent(ext); + dim[0] = ext[1]-ext[0]+1; + dim[1] = ext[3]-ext[2]+1; + dim[2] = ext[5]-ext[4]+1; + long ImMem = dim[0]*dim[1]*dim[2]*p->GetImage()->GetScalarSize();; +#endif mTotalMem += ImMem; GimmickMessage(5,"==> Image in memory = "<GetFilename(); GimmickMessage(5,"'" << filename << "'" << std::endl); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 mTotalMem -= unload->GetImage()->GetEstimatedMemorySize(); +#else + int ext[6]; + int dim[3]; + unload->GetImage()->GetExtent(ext); + dim[0] = ext[1]-ext[0]+1; + dim[1] = ext[3]-ext[2]+1; + dim[2] = ext[5]-ext[4]+1; + mTotalMem -= dim[0]*dim[1]*dim[2]*unload->GetImage()->GetScalarSize(); +#endif GimmickMessage(5," ==> Total mem = "< #include @@ -164,7 +165,7 @@ namespace creaImageIO } fclose(Ultrasonix_file); - im = crea::NewVtkImageDataFromRaw( dataRF, h.width, h.height, h.frame); + im = crea::NewVtkImageDataFromRaw( dataRF, h.width, h.height, h.frame); break; case TYPE_B8: @@ -182,7 +183,7 @@ namespace creaImageIO fclose(Ultrasonix_file); - im = crea::NewVtkImageDataFromRaw( dataB8, h.width, h.height, h.frame); + im = crea::NewVtkImageDataFromRaw( dataB8, h.width, h.height, h.frame); break; case TYPE_B32: @@ -200,7 +201,7 @@ namespace creaImageIO fclose(Ultrasonix_file); - im = crea::NewVtkImageDataFromRaw( dataB32, h.width, h.height, h.frame); + im = crea::NewVtkImageDataFromRaw( dataB32, h.width, h.height, h.frame); break; } diff --git a/src/creaImageIOUnMosaicVtkImageData.cpp b/src/creaImageIOUnMosaicVtkImageData.cpp index 7b00646..7536913 100644 --- a/src/creaImageIOUnMosaicVtkImageData.cpp +++ b/src/creaImageIOUnMosaicVtkImageData.cpp @@ -85,7 +85,13 @@ vtkImageData * creaImageIOUnMosaicVtkImageData::unMosaic(vtkImageData *imageIn, int outputdims[3]; imageIn->GetDimensions (inputdims); unsigned short *input = (unsigned short *)(imageIn->GetScalarPointer()); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageIn->Update(); +#else + // .. +#endif + unsigned int div = (unsigned int)ceil(sqrt( (double)numberOfImagesInMosaic ) ); outputdims[0] = inputdims[0] / div; @@ -96,12 +102,18 @@ vtkImageData * creaImageIOUnMosaicVtkImageData::unMosaic(vtkImageData *imageIn, vtkImageOut = vtkImageData::New(); vtkImageOut->SetDimensions( outputdims ); vtkImageOut->SetExtent(0,outputdims[0]-1,0,outputdims[1]-1,0,outputdims[2]-1); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkImageOut->SetWholeExtent(0,outputdims[0]-1,0,outputdims[1]-1,0,outputdims[2]-1); vtkImageOut->SetNumberOfScalarComponents(1); //vtkImageOut->SetSpacing( blabla ); vtkImageOut->SetScalarType( VTK_UNSIGNED_SHORT ); vtkImageOut->AllocateScalars(); vtkImageOut->Update(); +#else + vtkImageOut->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif unsigned short *output =(unsigned short *)(vtkImageOut->GetScalarPointer()); diff --git a/src/creaImageIOWxAnySimpleDlg.cpp b/src/creaImageIOWxAnySimpleDlg.cpp index 926e118..4a31cbe 100644 --- a/src/creaImageIOWxAnySimpleDlg.cpp +++ b/src/creaImageIOWxAnySimpleDlg.cpp @@ -29,13 +29,19 @@ #include "creaImageIOWxAnySimpleDlg.h" #include "creaImageIOWxGimmickReaderDialog.h" -#include + +#if ITK_VERSION_MAJOR < 4 // : WARNING: deprecated in ITK 4.0 +# include +# include +#else // ITK_VERSION_MAJOR < 4 +# include +#endif // ITK_VERSION_MAJOR < 4 + #include #include #include #include #include -#include #include #include #include @@ -88,7 +94,12 @@ namespace creaImageIO void WxAnySimpleDlg::OnReadFile(wxCommandEvent& event) { int resultShowModal; +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition); +#else + wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxFD_OPEN |wxFD_MULTIPLE, wxDefaultPosition); +#endif resultShowModal = fileDlg->ShowModal(); if ( resultShowModal==wxID_OK ) @@ -102,25 +113,28 @@ namespace creaImageIO std::string name = crea::wx2std(wxArray[i]); // FOR THE MOMENT ONLY short 3D et short 4D readImg(name); - } - } - else { + } // for + } else { // TO DO WARNING MESSAGES - } - } + } // if + } // if SetReturnCode( resultShowModal ); // Close(); EndModal( resultShowModal ); } + +///////////////////////////////////////////////////////////////////// +// // +////////////////////////////////////////////////////////////////////// void WxAnySimpleDlg::setExts(std::vector i_exts) { m_exts = i_exts; } - ///////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////// // // ////////////////////////////////////////////////////////////////////// - void WxAnySimpleDlg::OnReadDirectory(wxCommandEvent &event) { int resultShowModal; @@ -132,33 +146,55 @@ namespace creaImageIO if ( resultShowModal==wxID_OK ) { std::string path = crea::wx2std(dirDlg->GetPath()); + +/* typedef boost::filesystem::directory_iterator dir_it; dir_it itr(path); dir_it end_itr; - /*if (boost::filesystem::exists(path)) - {*/ +// if (boost::filesystem::exists(path)) +// { for(;itr != end_itr; ++itr) { - bvalid = m_exts.size() == 0? true : false; - std::vector::iterator it = m_exts.begin(); - std::string ext = itr->path().filename().string().substr(itr->path().filename().string().find_last_of(".")); - for(; it != m_exts.end(); it++) - { - if(ext == (*it) ) - { - bvalid = true; - break; - } - } +//EED +// All files have the same extention +// bvalid = m_exts.size() == 0? true : false; +// std::vector::iterator it = m_exts.begin(); +// std::string ext = itr->path().filename().string().substr(itr->path().filename().string().find_last_of(".")); +// for(; it != m_exts.end(); it++) +// { +// if(ext == (*it) ) +// { +// bvalid = true; +// break; +// } +// } // for +bvalid=true; if (!boost::filesystem::is_directory(itr->status()) && bvalid) { - readImg(itr->path().string().c_str()); - } - } - } +printf("EED WxAnySimpleDlg::OnReadDirectory Each file %s \n", itr->path().string().c_str() ); + readImg( itr->path().string().c_str() ); + } // if + } // for itr +*/ + + typedef vector vec; // store paths + vec v; // so we can sort them later + copy(boost::filesystem::directory_iterator(path), boost::filesystem::directory_iterator(), back_inserter(v)); + sort(v.begin(), v.end()); // sort, since directory iteration + // is not ordered on some file systems + for (vec::const_iterator it (v.begin()); it != v.end(); ++it) + { + readImg( it->string().c_str() ); + } // for + + + + + } // if OK SetReturnCode( resultShowModal ); // Close(); EndModal( resultShowModal ); + } ////////////////////////////////////////////////////////////////////// @@ -230,9 +266,11 @@ namespace creaImageIO return imageIO->GetNumberOfDimensions(); } + void WxAnySimpleDlg::readImg(const std::string &i_name) { size_t dims = getNumberOfDimensions(i_name); + //const std::type_info *type= &getType(i_name); switch(dims) { @@ -339,6 +377,7 @@ namespace creaImageIO } else { + printf("EED WxAnySimpleDlg::readImg Not type found for DIM 3 \n"); //????FCY, so what the type???? } break; @@ -481,6 +520,7 @@ namespace creaImageIO } else { + printf("EED WxAnySimpleDlg::readImg Not type found for DIM 4 \n"); //????FCY, so what the type???? } break; @@ -513,7 +553,11 @@ namespace creaImageIO { typedef itk::Image TImage; typedef itk::GDCMImageIO GDCMType; +#if ITK_VERSION_MAJOR < 4 typedef itk::DICOMSeriesFileNames dicnames; +#else // ITK_VERSION_MAJOR < 4 + typedef itk::GDCMSeriesFileNames dicnames; +#endif // ITK_VERSION_MAJOR < 4 GDCMType::Pointer gdcmIO = GDCMType::New(); dicnames::Pointer generator = dicnames::New(); diff --git a/src/creaImageIOWxAnySimpleDlg.h b/src/creaImageIOWxAnySimpleDlg.h index 51674d3..65c80a6 100644 --- a/src/creaImageIOWxAnySimpleDlg.h +++ b/src/creaImageIOWxAnySimpleDlg.h @@ -102,13 +102,13 @@ namespace creaImageIO for(; it != m_AnyImages.end(); it++) { imgs.push_back(boost::any_cast (*it)); - } + } // for return imgs; } bool AllSameType(); template void split3Din3Dvtk(TImage* i_Img) - { + { typedef itk::ImageToVTKImageFilter< TImage > ConnectorType; typename ConnectorType::Pointer connector = ConnectorType::New(); connector->SetInput(i_Img); @@ -116,17 +116,22 @@ namespace creaImageIO connector->Update(); vtkImageData *im = vtkImageData::New(); im->ShallowCopy(connector->GetOutput()); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 im->Update(); +#else + im->Modified(); +#endif + + m_Vresults.push_back(im); } - template void split4Din3Dvtk(TImage* i_Img); - private: - // strange compile error with gcc 4.5.1-4 //JPR std::vector m_AnyDims; //comment out const JPR std::vector m_AnyType; //comment out const JPR @@ -137,7 +142,6 @@ namespace creaImageIO wxString infoimage; std::string m_dir; - bool m_dicom; /// interface to read data SimpleView m_view; @@ -149,6 +153,5 @@ namespace creaImageIO const std::type_info & getType(const std::string &i_name); }; - }// namespace creaImageIO #endif //__creaImageWxAnySimpleDlg_h_INCLUDED__ diff --git a/src/creaImageIOWxDescriptorPanel.cpp b/src/creaImageIOWxDescriptorPanel.cpp index 60868d4..9f563b6 100644 --- a/src/creaImageIOWxDescriptorPanel.cpp +++ b/src/creaImageIOWxDescriptorPanel.cpp @@ -109,7 +109,14 @@ namespace creaImageIO // RESULT +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 ResultCtrl=new wxTextCtrl(this, ID_EL_CTRL,_T(""), wxPoint(5,150), wxSize(250,310), wxTE_READONLY| wxMac | wxTE_MULTILINE | wxTE_RICH ); +#else + ResultCtrl=new wxTextCtrl(this, ID_EL_CTRL,_T(""), wxPoint(5,150), wxSize(250,310), wxTE_READONLY| wxTE_MULTILINE | wxTE_RICH ); +#endif + + wxButton *RemoveCtrl = new wxButton(this, ID_REMOVE_ADD,_T("Remove an entry"), wxPoint(280,200) ); Connect( RemoveCtrl->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxDescriptorPanel::OnRemove ); @@ -588,7 +595,12 @@ namespace creaImageIO ////////////////////////////////////////////////// void WxDescriptorPanel::OnLoad(wxCommandEvent &Event) { +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 long style = wxOPEN | wxFILE_MUST_EXIST; +#else + long style = wxFD_OPEN | wxFD_FILE_MUST_EXIST; +#endif LevelCtrl->SetValue(_T("patient")); ResultCtrl->Clear(); DscpTree.clear(); @@ -635,7 +647,12 @@ namespace creaImageIO const std::string WxDescriptorPanel::saveDescriptor() { std::string file = ""; +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 long style = wxSAVE; +#else + long style = wxFD_SAVE; +#endif std::string wc("*.dscp"); wxFileDialog* FD = new wxFileDialog( 0, _T("Select file"), diff --git a/src/creaImageIOWxDumpPanel.cpp b/src/creaImageIOWxDumpPanel.cpp index 15e9966..7ee1f30 100644 --- a/src/creaImageIOWxDumpPanel.cpp +++ b/src/creaImageIOWxDumpPanel.cpp @@ -61,7 +61,14 @@ namespace creaImageIO wxToolBar *mToolBar = new wxToolBar(this,-1,wxDefaultPosition,wxDefaultSize); mToolBar->AddTool( DUMP_SAVE_ID,_T("Save"), mIcon->GetBitmap(0), _T("Save Dicom Tags in text file")); mToolBar->Realize(); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 DumpText = new wxTextCtrl( this, wxID_ANY,_T(""), wxPoint(5,30), wxSize(520,510), wxTE_READONLY| wxMac | wxTE_MULTILINE | wxTE_RICH ); +#else + DumpText = new wxTextCtrl( this, wxID_ANY,_T(""), wxPoint(5,30), wxSize(520,510), wxTE_READONLY | wxTE_MULTILINE | wxTE_RICH ); +#endif + Layout(); Print(); } @@ -221,8 +228,14 @@ namespace creaImageIO /////////////////////////////////////////////////// void WxDumpPanel::SaveInfos(wxCommandEvent& event) { +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog* FD = new wxFileDialog( 0,_T("Select file"), _T(""), _T(""), crea::std2wx("*.txt"), wxOPEN, wxDefaultPosition); +#else + wxFileDialog* FD = new wxFileDialog( 0,_T("Select file"), _T(""), _T(""), + crea::std2wx("*.txt"), wxFD_OPEN, wxDefaultPosition); +#endif if (FD->ShowModal()==wxID_OK) { wxBusyCursor busy; diff --git a/src/creaImageIOWxGimmickReaderDialog.cpp b/src/creaImageIOWxGimmickReaderDialog.cpp index 771bb05..8c11f03 100644 --- a/src/creaImageIOWxGimmickReaderDialog.cpp +++ b/src/creaImageIOWxGimmickReaderDialog.cpp @@ -80,8 +80,7 @@ namespace creaImageIO threads); mView->Initialize(); // Connect the AddProgress callback - mView->ConnectValidationObserver - ( boost::bind( &WxGimmickReaderDialog::OnValid , this, _1 ) ); + mView->ConnectValidationObserver( boost::bind( &WxGimmickReaderDialog::OnValid , this, _1 ) ); } catch (crea::Exception e) { diff --git a/src/creaImageIOWxGimmickTools.cpp b/src/creaImageIOWxGimmickTools.cpp index 2d06a41..b14ad66 100644 --- a/src/creaImageIOWxGimmickTools.cpp +++ b/src/creaImageIOWxGimmickTools.cpp @@ -56,11 +56,22 @@ namespace creaImageIO Connect( _addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onAddToDatabase ); Connect( _mhdCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onMHD ); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer *textSizer = new wxFlexGridSizer(1,2); +#else + wxFlexGridSizer *textSizer = new wxFlexGridSizer(2); +#endif + textSizer->Add( new wxStaticText(this, -1, _T("Transform a Bruker 'Serie'/'Study'/'set of Studies' directory into Dicom / MHD format.")), 1, wxGROW ); textSizer->Add( new wxStaticText(this, -1, _T("If checkbox is selected images will be loaded into the DB.")), 1, wxGROW ); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer *sizer = new wxFlexGridSizer(2,5); +#else + wxFlexGridSizer *sizer = new wxFlexGridSizer(5); +#endif sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW ); sizer->Add( new wxStaticText(this, -1, _T(" ")), 1, wxGROW ); sizer->Add( _inputPath, 1, wxGROW ); @@ -72,7 +83,12 @@ namespace creaImageIO sizer->Add( _addCheckBox, 1, wxGROW ); sizer->Add( _mhdCheckBox, 1, wxGROW ); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer *topSizer = new wxFlexGridSizer(1, 2); +#else + wxFlexGridSizer *topSizer = new wxFlexGridSizer(2); +#endif topSizer->Add( textSizer, 1, wxGROW ); topSizer->Add( sizer, 1, wxGROW ); this->SetSizer( topSizer ); diff --git a/src/creaImageIOWxGimmickView.cpp b/src/creaImageIOWxGimmickView.cpp index ef9ee5c..11e8c88 100644 --- a/src/creaImageIOWxGimmickView.cpp +++ b/src/creaImageIOWxGimmickView.cpp @@ -504,7 +504,15 @@ namespace creaImageIO void WxGimmickView::OnAddFiles(wxCommandEvent& event) { mViewer->StopPlayer(); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 long style = wxOPEN | wxFILE_MUST_EXIST | wxFD_MULTIPLE; +#else + long style = wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE; +#endif + + std::string wc("*"); wxFileDialog* FD = new wxFileDialog( 0, _T("Select file"), @@ -700,7 +708,11 @@ namespace creaImageIO { ClearSelection(); }*/ - ReadImageThreaded(sel); + + printf("EED Warnning WxGimmickView::OnSelectionChange ....... To avoid threads conflicts//ReadImageThreaded(sel)\n "); +//EED1 ReadImageThreaded(sel); + + } //================================================== diff --git a/src/creaImageIOWxGimmickView.h b/src/creaImageIOWxGimmickView.h index e472420..62e1136 100644 --- a/src/creaImageIOWxGimmickView.h +++ b/src/creaImageIOWxGimmickView.h @@ -56,7 +56,7 @@ namespace creaImageIO //===================================================================== /// Concrete derivative of GimmickView which implements a wxWidgets-based view - class WxGimmickView : public wxPanel, virtual public GimmickView + class CREAIMAGEIO_EXPORT WxGimmickView : public wxPanel, virtual public GimmickView { public: diff --git a/src/creaImageIOWxSimpleDlg.cpp b/src/creaImageIOWxSimpleDlg.cpp index 1c076b0..88cf784 100644 --- a/src/creaImageIOWxSimpleDlg.cpp +++ b/src/creaImageIOWxSimpleDlg.cpp @@ -69,7 +69,12 @@ namespace creaImageIO void WxSimpleDlg::OnReadFile(wxCommandEvent& event) { int resultShowModal; +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition); +#else + wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxFD_OPEN |wxFD_MULTIPLE, wxDefaultPosition); +#endif resultShowModal = fileDlg->ShowModal(); if ( resultShowModal==wxID_OK ) @@ -145,9 +150,7 @@ namespace creaImageIO dlg.ShowModal(); if (dlg.GetReturnCode() == wxID_OK) { - dlg.stopReading(); - std::vector outStrGimmick; - dlg.getSelected(outStrGimmick, m_attrDicomTags,true,""); +//EED1 dlg.stopReading(); m_results.clear(); int size=(int)outStrGimmick.size(); int ii; @@ -155,8 +158,6 @@ namespace creaImageIO // { for (ii=0;iiModified(); - outStrGimmick[ii].img->Update(); m_results.push_back(outStrGimmick[ii].img); m_resultsDicomAtr.push_back( outStrGimmick[ii].infos ); } @@ -231,12 +232,14 @@ namespace creaImageIO first->GetDimensions(dim); if (dim[2]==1) { - vtkImageData *out; - out = vtkImageData::New(); - out->SetScalarType(first->GetScalarType()); - out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); + vtkImageData *out = vtkImageData::New(); int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); +#else + first->GetExtent(ext); +#endif if(ext[5] == 0) { ext[5] = getImagesSelected().size()-1; @@ -253,8 +256,18 @@ namespace creaImageIO } out->SetSpacing(spac); out->SetDimensions(dim[0], dim[1], getImagesSelected().size() ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + + out->SetScalarType(first->GetScalarType()); + out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out->AllocateScalars(); out->Update(); +#else + out->AllocateScalars(first->GetScalarType(),first->GetNumberOfScalarComponents()); +#endif + + unsigned long imsize = dim[0] * dim[1]; imsize = imsize * dim[2]; // deal with multiframes here // differents formats char , short, etc... diff --git a/src/creaImageIOWxTreeView.cpp b/src/creaImageIOWxTreeView.cpp index 3c1f308..c28e00a 100644 --- a/src/creaImageIOWxTreeView.cpp +++ b/src/creaImageIOWxTreeView.cpp @@ -27,7 +27,6 @@ #include #include - #include #include #include @@ -419,11 +418,7 @@ namespace creaImageIO std::vector::const_iterator i; for (i=sel.begin(); i!=sel.end(); ++i) { - GimmickMessage(1, - "deleting '" - <<(*i)->GetLabel() - <<"'"<GetLabel() << "'" << mLastLevel << std::endl ); if((*i)->GetParent()->GetNumberOfChildren()<2) { needRefresh=true; diff --git a/src/creaImageIOWxViewer.cpp b/src/creaImageIOWxViewer.cpp index 7f15e40..ee2258a 100644 --- a/src/creaImageIOWxViewer.cpp +++ b/src/creaImageIOWxViewer.cpp @@ -85,7 +85,7 @@ namespace creaImageIO mLastImageShown = NULL; // previewer - mInteractor = new crea::creawxVTKRenderWindowInteractor(this,-1); + mInteractor = new crea::wxVTKRenderWindowInteractor(this,-1); mInteractor->UseCaptureMouseOn(); mViewer = vtkImageViewer2::New(); @@ -207,20 +207,40 @@ namespace creaImageIO <SetInput(im); +#else + mViewer->SetInputData(im); +#endif mViewer->SetSlice( 0 ); int x1,x2,y1,y2,z1,z2; double spx,spy,spz; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 im->Update(); +#else + // ... +#endif + //std::cout << "in WxViewer::ShowImage PrintSelf() ="; //im->PrintSelf(std::cout, vtkIndent(2)); im->GetSpacing(spx,spy,spz); //im->GetExtent (x1,x2,y1,y2,z1,z2); // JPR + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 im->GetWholeExtent (x1,x2,y1,y2,z1,z2); +#else + im->GetExtent (x1,x2,y1,y2,z1,z2); +#endif + + /* std::cout << "in WxViewer::ShowImage GetWholeExtent ext ="; std::cout << " [x1]=" << x1; diff --git a/src/creaImageIOWxViewer.h b/src/creaImageIOWxViewer.h index 9647b3b..566e316 100644 --- a/src/creaImageIOWxViewer.h +++ b/src/creaImageIOWxViewer.h @@ -49,7 +49,7 @@ namespace creaImageIO class WxViewerPlayer; - class WxViewer : public wxPanel + class CREAIMAGEIO_EXPORT WxViewer : public wxPanel { public: @@ -97,7 +97,7 @@ namespace creaImageIO wxCheckBox *mcheck; /// Associated wxvtk interactor - crea::creawxVTKRenderWindowInteractor *mInteractor; + crea::wxVTKRenderWindowInteractor *mInteractor; /// Current extent int mx1,mx2,my1,my2,mz1,mz2;