X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=creaImageIO.git;a=blobdiff_plain;f=src%2FcreaImageIOSimpleView.cpp;fp=src%2FcreaImageIOSimpleView.cpp;h=c7a1bd8a929903690a1a35517cd2cc736804a336;hp=96d0e7442bda4713e5f973fc01d1cf9c04df0494;hb=6b7ccc72c2f9cee3979d9360a55eaa65aeea8a17;hpb=f4345fcbbb606af15d5af72b6179d5103ff75565 diff --git a/src/creaImageIOSimpleView.cpp b/src/creaImageIOSimpleView.cpp index 96d0e74..c7a1bd8 100644 --- a/src/creaImageIOSimpleView.cpp +++ b/src/creaImageIOSimpleView.cpp @@ -25,11 +25,12 @@ # ------------------------------------------------------------------------ */ - -#include "creaImageIOSimpleView.h" #include "boost/filesystem/operations.hpp" #include "boost/filesystem/fstream.hpp" +#include "creaImageIOSimpleView.h" +#include "creaImageIOUnMosaicVtkImageData.h" + namespace creaImageIO { bool SimpleView::readFile( std::vector i_filenames, // in information names @@ -37,6 +38,21 @@ namespace creaImageIO std::vector > &i_imgAttr, // out information attributes names-values std::vector &i_img) // out information vtkImageData { +printf("EED SimpleView::readFile 0\n"); + + //Mosaic Attribute for Simens + i_attr.push_back("D0019_100a"); // Number of images in mosaic (Simens) + i_attr.push_back("D0018_0088"); // Spacing Between Slices + + + + creaImageIOUnMosaicVtkImageData Mosaic; + vtkImageData* tmpImg1; + vtkImageData* tmpImg2; + int numberOfImagesInMosaic; + double spc[3]; + double spcZ; + bool bresult, bfinal = true; ImageReader *mReader = new ImageReader(); std::vector::iterator it = i_filenames.begin(); @@ -49,15 +65,49 @@ namespace creaImageIO mReader->getAttributes( (*it).c_str() , mapAttr, i_attr ); // filename, outMapAttr-NameValue, inVectAttributeName i_imgAttr.push_back( mapAttr ); - //UnMosaic step.. +//EED borrame +// i_img.push_back( mReader->ReadImage( (*it).c_str() ) ); + +printf("EED SimpleView::readFile 1\n"); + + // EED 18 octt 2014 + std::map ::iterator itMapAttr; + std::string numberOfImagesInMosaicStr=""; + std::string spaceBetweenSliceStr=""; + + itMapAttr = mapAttr.find("D0019_100a"); + if ( itMapAttr!=mapAttr.end() ) numberOfImagesInMosaicStr = itMapAttr->second; + +// std::string numberOfImagesInMosaicStr = mapAttr.find("D0019_100a")->second; +printf("EED SimpleView::readFile 1.1\n"); + itMapAttr = mapAttr.find("D0018_0088"); + if ( itMapAttr!=mapAttr.end() ) spaceBetweenSliceStr = itMapAttr->second; + +// std::string spaceBetweenSliceStr = mapAttr.find("D0018_0088")->second; +printf("EED SimpleView::readFile 1.2\n"); + if (numberOfImagesInMosaicStr=="") + { +printf("EED SimpleView::readFile 2\n"); + i_img.push_back( mReader->ReadImage( (*it).c_str() ) ); + } else { +printf("EED SimpleView::readFile 3\n"); + numberOfImagesInMosaic = atoi(numberOfImagesInMosaicStr.c_str()); + spcZ = atoi(spaceBetweenSliceStr.c_str()); + tmpImg1 = mReader->ReadImage( (*it).c_str() ) ; + tmpImg1->GetSpacing( spc ); + tmpImg2 = Mosaic.unMosaic( tmpImg1 , numberOfImagesInMosaic ); + tmpImg2->SetSpacing( spc[0], spc[1], spcZ ); + i_img.push_back( tmpImg2 ); + }// elemet - i_img.push_back( mReader->ReadImage( (*it).c_str() ) ); } else { printf("ERROR. Impossible to read file %s\n", (*it).c_str() ); bfinal = false; } // if } // for delete mReader; +printf("EED SimpleView::readFile 4\n"); + return bfinal; }