X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FcreaImageIOGimmickView.cpp;h=6d03b9e5976f0a769c5bcfd24e327b59e5289303;hb=4b41fc61713111880cdb219f3f2edfda40346a32;hp=2b7c85b1883a8a8e4a5f4c1cafc903c92eab60ec;hpb=bf3660569b1baa8be10fc708f595efc66afe3334;p=creaImageIO.git diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 2b7c85b..6d03b9e 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -28,20 +28,20 @@ namespace creaImageIO public: ImageExtent(const std::string& x, const std::string& y, const std::string& z, const std::string& t) { - sscanf(x.c_str(),"%d",&mExtent[0]); - sscanf(y.c_str(),"%d",&mExtent[1]); - sscanf(z.c_str(),"%d",&mExtent[2]); - sscanf(t.c_str(),"%d",&mExtent[3]); - if(x==""){mExtent[0]=1;} - if(y==""){mExtent[1]=1;} - if(z==""){mExtent[2]=1;} - if(t==""){mExtent[3]=1;} - - if (mExtent[3]>1) mDim=4; - else if (mExtent[2]>1) mDim=3; - else if (mExtent[1]>1) mDim=2; - else if (mExtent[0]>1) mDim=1; - else mDim=0; + sscanf(x.c_str(),"%d",&mExtent[0]); + sscanf(y.c_str(),"%d",&mExtent[1]); + sscanf(z.c_str(),"%d",&mExtent[2]); + sscanf(t.c_str(),"%d",&mExtent[3]); + if(x==""){mExtent[0]=1;} + if(y==""){mExtent[1]=1;} + if(z==""){mExtent[2]=1;} + if(t==""){mExtent[3]=1;} + + if (mExtent[3]>1) mDim=4; + else if (mExtent[2]>1) mDim=3; + else if (mExtent[1]>1) mDim=2; + else if (mExtent[0]>1) mDim=1; + else mDim=0; } @@ -218,30 +218,11 @@ namespace creaImageIO } else { - std::string extentx = (*sel).GetAttribute("D0028_0010"); - std::string extenty = (*sel).GetAttribute("D0028_0011"); - std::string extentz = (*sel).GetAttribute("D0028_0012"); - std::string extentt = (*sel).GetAttribute("D0028_0010"); - if( extentx == "" && extenty == "" && extentz == "") - { - // we try to create a vtkImageData just to get dim informations - // Long method need to improve it! - std::string name = (*sel).GetAttribute("FullFileName"); - if (name != "") - { - int dim[3]; - char c[5]; - mReader.GetImage(name)->GetDimensions(dim); - sprintf(c,"%d", dim[0]); - extentx = c; - sprintf(c,"%d", dim[1]); - extenty = c; - sprintf(c,"%d", dim[2]); - extentz = c; - } - } + boost::shared_ptr ie=boost::shared_ptr(new ImageExtent((*sel).GetAttribute("D0028_0010"), + (*sel).GetAttribute("D0028_0011"), + (*sel).GetAttribute("D0028_0012"), + "")); - boost::shared_ptr ie=boost::shared_ptr(new ImageExtent(extentx, extenty, extentz,extentt)); if(mImageExtent==0) { mImageExtent=ie; @@ -436,7 +417,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect vtkImageData* first = mReader.GetImage( i_file); int dim[3]; first->GetDimensions(dim); - if (dim[3] > 1) + if (dim[2] > 1) { bres = false; } @@ -481,7 +462,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect // If we want only one output information structure, we set it outside the loop if(!i_attr.mult) { - getAttributes(im.front(), o_output.front().infos,i_attr); + getAttributes(im.front(), o_output.front().infos, i_attr); } } @@ -583,7 +564,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect } - ////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////// // create an output structure with n entries (T size) = T + n output ////////////////////////////////////////////////////////// void GimmickView::readImages4(std::vector& o_output, std::vector im, @@ -704,7 +685,6 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect - void GimmickView::ReadImagesNotThreadedInVector(std::vector& s, std::vector im, int dimension) { // Create the output data @@ -946,4 +926,4 @@ void GimmickView::ReadImagesNotThreadedInVector(std::vector& s, s // } //} // -} // EO namespace creaImageIO \ No newline at end of file +} // EO namespace creaImageIO