From 7a7557d18e0cd9551a5d0abc3de53e811f11f76e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 10 Mar 2016 16:01:54 +0100 Subject: [PATCH] #2842 creaImageIO Bug New Normal - Read images from directory --- .../bbcreaImageIOImagesChooserDialogBox.xml | 78 +------------------ src/creaImageIOSimpleView.cpp | 11 +-- 2 files changed, 3 insertions(+), 86 deletions(-) diff --git a/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml b/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml index 816784b..ee366f5 100644 --- a/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml +++ b/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml @@ -79,9 +79,6 @@
-	
-	     
-
         creaImageIO::WxSimpleDlg dlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database"); 
                 dlg.SetAttrDicomTags( bbGetInputDicomTags() );
 		dlg.ShowModal(); 
@@ -90,84 +87,11 @@
 		{ 
 			bbSetOutputFileName( std::string( dlg.getInfoImage().mb_str() ) );
 			bbSetOutputOut( dlg.getVolumeSelected() );
-		
-/*
-		  if(dlg.getImagesSelected().size() ==1)
-		  {
-			bbSetOutputOut( dlg.getImagesSelected()[0] );  
-		  } else {
-			  // FCY: it will be a big problem if we have several kind of data in the same folder.
-			  // creation of a huge vtkImageData!!!!
-			  vtkImageData* first = dlg.getImagesSelected()[0];
-			  int dim[3];
-			  first->GetDimensions(dim);
-			  if (dim[2]==1){
-			 	 vtkImageData *out;
-			  	out  = vtkImageData::New();
-			  	out->SetScalarType(first->GetScalarType());
-			  	out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
-			  	int ext[6];
-			  	first->GetWholeExtent(ext); 
-			  	if(ext[5] == 0)
-			  	{
-			 	   ext[5] = dlg.getImagesSelected().size()-1;
-			 	 } else {
-					ext[5] = ext[5] * dlg.getImagesSelected().size()-1; // to deal with multiframes 
-			  	} // ext
-			  	out->SetExtent(ext);
-			  	double spac[3];
-			  	first->GetDimensions(dim);
-			  	first->GetSpacing(spac);
- 			  	if (spac[0]==spac[1])
-                          	{
-                               		spac[2]=spac[0];  
-		          	}
-		          	out->SetSpacing(spac);
-			  	out->SetDimensions(dim[0], dim[1], dlg.getImagesSelected().size() );
-			  	out->AllocateScalars();
-			  	out->Update();
-			  	unsigned long imsize = dim[0] * dim[1];
-			  	imsize = imsize * dim[2];  // deal with multiframes here
-			  	// differents formats char , short, etc...
-			  	// differents components 1..3  ex. jpg ->RGB 3
-			  	imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents();
-  		        	int slice,sizeImageVector=dlg.getImagesSelected().size();
-                        	for (slice=0 ; sliceGetScalarPointer(0,0,slice), img->GetScalarPointer(0,0,0), imsize);
-				//img->Delete();
-				 } // for slice	
-
-//EED This is NOT working. The iteration over the pointer vtkImageData
-//		      	int slice=0;
-//		      	std::vector::iterator it;
-//		      	for (it=dlg.getImagesSelected().begin(); it!=dlg.getImagesSelected().end(); ++it) 
-//			{
-//				  memcpy(out->GetScalarPointer(0,0,slice), (*it)->GetScalarPointer(0,0,0), imsize);
-//				  slice++;
-//			}	
-//		       //for (it=dlg.getImagesSelected().begin(); it!=dlg.getImagesSelected().end(); ++it) 
-//			//  {
-// 			//	(*it)->Delete();
-//			//  }
-
-			 	bbSetOutputOut(out);
-
-			} else {
-			 bbSetOutputOut(first);
-			} // dim
-		  }
-*/
 
 		} else { 
 			bbSetOutputOut( NULL );
-	} // dlg.getImagesSelected().size()!=0
-
-
-
+		} // if dlg.getImagesSelected().size()!=0
         bbSetOutputOutImages( dlg.getImagesSelected());  
-printf("EED  creaImageIOWxSimpleDlg 5 \n");
     
diff --git a/src/creaImageIOSimpleView.cpp b/src/creaImageIOSimpleView.cpp index c7a1bd8..43bbdf0 100644 --- a/src/creaImageIOSimpleView.cpp +++ b/src/creaImageIOSimpleView.cpp @@ -34,11 +34,10 @@ namespace creaImageIO { bool SimpleView::readFile( std::vector i_filenames, // in information names - std::vector i_attr, // in information attributes names + std::vector i_attr, // in information attributes names std::vector > &i_imgAttr, // out information attributes names-values - std::vector &i_img) // out information vtkImageData + 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) @@ -68,7 +67,6 @@ printf("EED SimpleView::readFile 0\n"); //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; @@ -79,18 +77,14 @@ printf("EED SimpleView::readFile 1\n"); 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() ) ; @@ -106,7 +100,6 @@ printf("EED SimpleView::readFile 3\n"); } // if } // for delete mReader; -printf("EED SimpleView::readFile 4\n"); return bfinal; } -- 2.46.2