void ItkImagesChooserDialogBox::Export()
{
typedef itk::Image<ty,di> TImage;
-
-printf("EED ItkImagesChooserDialogBox::Export Start \n");
if (dlg->getImagesSelected().size() == 1)
{
-printf("EED ItkImagesChooserDialogBox::Export 1\n");
bbSetOutputOut( dlg->getTemplatedImagesSelected<TImage>().front().GetPointer() );
} else if (dlg->getImagesSelected().size() > 1){
-printf("EED ItkImagesChooserDialogBox::Export 2\n");
OutputImagesITKType outVect;
typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
} // for
bbSetOutputOutIImages( outVect);
-//EED creater one 3D image from 2D list
-// const unsigned int Dimension = 3;
-// typedef itk::RGBPixel< unsigned char > RGBPixelType;
-// typedef itk::Image< RGBPixelType, Dimension > RGBImageType;
-// typedef itk::ImportImageFilter< RGBPixelType, Dimension > ImportFilterType;
-
-// typedef itk::RGBPixel< ty > RGBPixelType;
typedef ty RGBPixelType;
typedef itk::ImportImageFilter< ty , di > ImportFilterType;
- typename ImportFilterType::Pointer importFilter = ImportFilterType::New();
-
+ typename ImportFilterType::Pointer importFilter = ImportFilterType::New();
typename TImage::SizeType imsize;
-// imsize[0] = img.width();
-// imsize[1] = img.height();
imsize[0] = tempImgs[0].GetPointer()->GetLargestPossibleRegion().GetSize()[0];
imsize[1] = tempImgs[0].GetPointer()->GetLargestPossibleRegion().GetSize()[1];
imsize[2] = tempImgs.size();
-printf("EED ItkImagesChooserDialogBox::Export 2.10\n");
typename ImportFilterType::IndexType start;
start.Fill( 0 );
region.SetSize( imsize );
importFilter->SetRegion( region );
-// const itk::SpacePrecisionType origin[ di ] = { 0.0, 0.0, 0.0 };
const itk::SpacePrecisionType origin[ 3 ] = { 0.0, 0.0, 0.0 };
importFilter->SetOrigin( origin );
-// const itk::SpacePrecisionType spacing[ di ] = { 1.0, 1.0, 1.0 };
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 numberOfPixels3D = imsize[0]*imsize[1]*imsize[2];
+ 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 * localBuffer = new RGBPixelType[ numberOfPixels3D ];
RGBPixelType * tmpLocalBuffer = localBuffer;
-printf("EED ItkImagesChooserDialogBox::Export 2.20\n");
it = tempImgs.begin();
for(;it != tempImgs.end(); ++it)
{
-printf("EED ItkImagesChooserDialogBox::Export 2.30\n");
- memcpy(tmpLocalBuffer, (*it).GetPointer()->GetBufferPointer(), numberOfPixels2D);
+ memcpy(tmpLocalBuffer, (*it).GetPointer()->GetBufferPointer(), numberOfPixels2DInBytes);
tmpLocalBuffer = tmpLocalBuffer + numberOfPixels2D;
} // for
const bool importImageFilterWillOwnTheBuffer = true;
importFilter->SetImportPointer( localBuffer , numberOfPixels3D , importImageFilterWillOwnTheBuffer );
-importFilter->Update();
-importFilter->Register();
-printf("EED ItkImagesChooserDialogBox::Export 2.40\n");
-
-// bbSetOutputOut( (*tempImgs.begin()).GetPointer() );
-// bbSetOutputOut( importFilter->GetOutput().unsafe_get<TImage*>() );
+ importFilter->Update();
+ importFilter->Register();
bbSetOutputOut( importFilter->GetOutput() );
-printf("EED ItkImagesChooserDialogBox::Export 2.50\n");
} else {
-printf("EED ItkImagesChooserDialogBox::Export 3\n");
// warning: passing NULL to non-pointer
//bbSetOutputOut( NULL);
bbSetOutputOut(0); // JPR
}
- // FCY To test the Output
- //typedef itk::Image <short, 3> 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());
-
-printf("EED ItkImagesChooserDialogBox::Export End \n");
-
}
template <class TImage>
void ItkImagesChooserDialogBox::ExportVTK()
{
-printf("EED ItkImagesChooserDialogBox::ExportVTK Start \n");
-
// BBTK can support only a vector with same dimensions image.
if (dlg->getDims().front() < 4)
{
} else {
// NOT IMPLEMENTED YET FOR DIMENSIONS > 4
} // if dlg
-printf("EED ItkImagesChooserDialogBox::ExportVTK End \n");
}
//=====
//////////////////////////////////////////////////////////////////////
void WxAnySimpleDlg::OnReadDirectory(wxCommandEvent &event)
{
-printf("EED WxAnySimpleDlg::OnReadDirectory Start\n");
int resultShowModal;
bool bvalid = false;
long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
if ( resultShowModal==wxID_OK )
{
std::string path = crea::wx2std(dirDlg->GetPath());
-printf("EED WxAnySimpleDlg::OnReadDirectory path %s\n", path.c_str() );
/*
typedef boost::filesystem::directory_iterator dir_it;
for (vec::const_iterator it (v.begin()); it != v.end(); ++it)
{
readImg( it->string().c_str() );
- cout << " " << *it << '\n';
- }
+ } // for
SetReturnCode( resultShowModal );
// Close();
EndModal( resultShowModal );
-printf("EED WxAnySimpleDlg::OnReadDirectory End\n");
}
{
size_t dims = getNumberOfDimensions(i_name);
-printf("EED WxAnySimpleDlg::readImg dims=%d \n",dims);
-
//const std::type_info *type= &getType(i_name);
switch(dims)
{