From 57a1d032c9ce2393c8b851452f65ef9d7fb51945 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 14 Dec 2022 09:59:26 +0100 Subject: [PATCH] #3493 BUG IPP bbgdcmvtk GetXCoherentInfoGdcmReader box --- .../bbgdcmvtkGetXCoherentInfoGdcmReader.cxx | 17 ++- packages/std/src/bbstdVectorFilterString.cxx | 135 +++++++++++++++++- packages/std/src/bbstdVectorFilterString.h | 6 +- 3 files changed, 148 insertions(+), 10 deletions(-) diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx index c8a1e47..008bd0e 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx @@ -131,7 +131,6 @@ void GetXCoherentInfoGdcmReader::Process() // Add *all the files* to the SerieHelper sh = GDCM_NAME_SPACE::SerieHelper::New(); std::vector gii = bbGetInputIn(); - for(std::vector::iterator it = gii.begin(); it != gii.end(); ++it) @@ -141,10 +140,8 @@ void GetXCoherentInfoGdcmReader::Process() GDCM_NAME_SPACE::FileList::const_iterator it; GDCM_NAME_SPACE::FileList *l; - // Should only contain one! l = sh->GetFirstSingleSerieUIDFileSet(); - if (l==NULL) { return; @@ -170,9 +167,20 @@ void GetXCoherentInfoGdcmReader::Process() int iTag,sizeDicomTagsVector=bbGetInputDicomTags().size(); GDCM_NAME_SPACE::FileList::const_iterator iitt = l->begin(); //iitt ++; + printf("EED GetXCoherentInfoGdcmReader::Process 1 \n"); for ( ; iitt != l->end(); ++iitt) { + if ( iitt == l->begin() ) // The first ordered element IPP + { + group = 0; + elem = 0; + strTagValue = std::string("void"); + sscanf("D0020_0032","D%04hx_%04hx",&group,&elem); + strTagValue = (*iitt)->GetEntryString(group,elem); + printf("EED GetXCoherentInfoGdcmReader::Process position %s \n",strTagValue.c_str() ); + } // if first elemetn get IPP + MapInfoDicom mapinfodicom; for (iTag=0; iTagGetEntryString(group,elem); mapinfodicom.insert ( std::pair(key,strTagValue) ); } // for iTag - vectormapinfodicom.push_back( mapinfodicom ); } // for iitt bbSetOutputDicomInfo( vectormapinfodicom ); @@ -213,7 +220,7 @@ void GetXCoherentInfoGdcmReader::Process() #if defined USE_GDCM2 void GetXCoherentInfoGdcmReader::Process() { - printf("GetXCoherentInfoGdcmReader %d files.\n", bbGetInputIn().size() ); +// printf("GetXCoherentInfoGdcmReader %d files.\n", bbGetInputIn().size() ); // Read the *first* image file (a SET of file names is given as input) gdcm::Reader *read = new gdcm::Reader(); reader->SetFileName( bbGetInputIn()[0].c_str() ); diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx index d7ceec8..fc996ad 100644 --- a/packages/std/src/bbstdVectorFilterString.cxx +++ b/packages/std/src/bbstdVectorFilterString.cxx @@ -3,6 +3,9 @@ //===== #include "bbstdVectorFilterString.h" #include "bbstdPackage.h" + +#include +#include namespace bbstd { @@ -23,9 +26,9 @@ void VectorFilterString::ConnectionRepetitions( std::vector vIn,std { acum++; } else { - itmp=i; + itmp = i; vOut->push_back(std::to_string(acum)); - acum=1; + acum = 1; } } // for vOut->push_back(std::to_string(acum)); @@ -129,8 +132,6 @@ void VectorFilterString::InvertLists() std::vector vOut8; std::vector vOut9; int i,size = bbGetInputIn0().size(); -// std::string sk1 = bbGetInputsk1(); -// int pos = atoi( bbGetInputsk2().c_str() ); for (i=size-1; i>=0; i--) { if ( i < bbGetInputIn0().size() ) { vOut0.push_back( bbGetInputIn0()[i] ); } @@ -157,6 +158,122 @@ void VectorFilterString::InvertLists() } +void VectorFilterString::SwitchElement(std::vector *pVec, int i, int ii ) +{ + std::string tmp; + + if ( (isize()) && (iisize()) ) + { + tmp = (*pVec)[i]; + (*pVec)[i] = (*pVec)[ii]; + (*pVec)[ii] = tmp; + } // if size +} + +void VectorFilterString::OrderLists() +{ + std::vector vOut0=bbGetInputIn0(); + std::vector vOut1=bbGetInputIn1(); + std::vector vOut2=bbGetInputIn2(); + std::vector vOut3=bbGetInputIn3(); + std::vector vOut4=bbGetInputIn4(); + std::vector vOut5=bbGetInputIn5(); + std::vector vOut6=bbGetInputIn6(); + std::vector vOut7=bbGetInputIn7(); + std::vector vOut8=bbGetInputIn8(); + std::vector vOut9=bbGetInputIn9(); + int i,ii,size = bbGetInputIn0().size(); + bool ok; + for (i=0; i<=size; i++) + { + for (ii=i; ii<=size; ii++) + { + ok=false; + if (bbGetInputType()==5) + { + if ( vOut0[i] > vOut0[ii] ) + { + ok = true; + } // if vIn0[i] > vIn0[ii] // string version + } // if Type == 5 + if (bbGetInputType()==6) + { +// if ( std::stod( vOut0[i] ) > std::stod( vOut0[ii] ) ) + if ( ::atof( vOut0[i].c_str() ) > ::atof( vOut0[ii].c_str() ) ) + { + ok = true; + } // if vIn0[i] > vIn0[ii] double version + } // if Type == 6 + + if (ok==true) + { + SwitchElement( &vOut0 , i ,ii ); + SwitchElement( &vOut1 , i ,ii ); + SwitchElement( &vOut2 , i ,ii ); + SwitchElement( &vOut3 , i ,ii ); + SwitchElement( &vOut4 , i ,ii ); + SwitchElement( &vOut5 , i ,ii ); + SwitchElement( &vOut6 , i ,ii ); + SwitchElement( &vOut7 , i ,ii ); + SwitchElement( &vOut8 , i ,ii ); + SwitchElement( &vOut9 , i ,ii ); + } // if ok + } // for ii + } // for i + bbSetOutputOut0( vOut0 ); + bbSetOutputOut1( vOut1 ); + bbSetOutputOut2( vOut2 ); + bbSetOutputOut3( vOut3 ); + bbSetOutputOut4( vOut4 ); + bbSetOutputOut5( vOut5 ); + bbSetOutputOut6( vOut6 ); + bbSetOutputOut7( vOut7 ); + bbSetOutputOut8( vOut8 ); + bbSetOutputOut9( vOut9 ); +} + +void VectorFilterString::SubString() +{ + std::vector vOut0; + std::vector vOut1; + std::vector vOut2; + std::vector vOut3; + std::vector vOut4; + std::vector vOut5; + std::vector vOut6; + std::vector vOut7; + std::vector vOut8; + std::vector vOut9; + int i,size = bbGetInputIn0().size(); + int sk1 = atoi( bbGetInputsk1().c_str() ); + int sk2 = atoi( bbGetInputsk2().c_str() ); + for (i=0; i *pVec, int id1, int id2 ); + void OrderLists(); + void SubString(); + //===== // 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) //===== @@ -70,7 +74,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterString,bbtk::AtomicBlackBox); BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector,""); BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector,""); BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector,""); - BBTK_INPUT(VectorFilterString,Type,"(Default 0) 0:count connected repetitions, 1:CleaningPointsConnectTwoMesh sk1 criterium, 2: Select lines contain sk1 in In0 (the other intputs In1..In9 are afected, 3: insert string:sk1 in position:sk2 for all elements ), 4: Invert input lists",int,""); + BBTK_INPUT(VectorFilterString,Type,"(Default 0) 0:count connected repetitions, 1:CleaningPointsConnectTwoMesh sk1 criterium, 2: Select lines contain sk1 in In0 (the other intputs In1..In9 are afected, 3: insert string:sk1 in position:sk2 for all elements ), 4: Invert input lists, 5:Order lists with (string)In0 criterius, 6:Order lists with (double)In0 criterius 7:sub string sk1=pos sk2=len for all lists ",int,""); BBTK_INPUT(VectorFilterString,sk1,"constant 1",std::string,""); BBTK_INPUT(VectorFilterString,sk2,"constant 2",std::string,""); -- 2.47.1