X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_ManagerContour_NDimensions%2FwxContourMainFrame.cxx;h=ab009b96f3fe3dbbb6e22c6ef3b61fb814a1f102;hb=55a723498899a7c68dcdc6883a9b352dfa140607;hp=0b9b0093ca848863a0138a948bc5c5e52e9132bc;hpb=ffd5933600d8bad1de6ee62c305cc26a046166dd;p=creaContours.git diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 0b9b009..ab009b9 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -1475,7 +1475,7 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d //DefinciÛn de conexiÛnes entre VTK e ITK y el writer typedef itk::VTKImageToImageFilter ConnectorType; typedef itk::ImageToVTKImageFilter ConnectorType2; - typedef itk::ImageFileWriter< OutputImageType > WriterType; +//EED10JUIN2011 typedef itk::ImageFileWriter< OutputImageType > WriterType; ConnectorType::Pointer connector= ConnectorType::New(); ConnectorType2::Pointer connector2= ConnectorType2::New(); @@ -1515,7 +1515,12 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New(); - + +printf("EED wxContourMainFrame::SegmentationOneSliceITK Skypping this code. Not compiling GeodesicActiveContourLevelSetImageFilter in fedora 17 with ITK 3.20.1 \n "); +/*EED 17 sept 2010 + >>>>>>>>>>> Not compiling GeodesicActiveContourLevelSetImageFilter in fedora 17 with ITK 3.20.1 + + typedef itk::GeodesicActiveContourLevelSetImageFilter< InternalImageType, InternalImageType > GeodesicActiveContourFilterType; GeodesicActiveContourFilterType::Pointer geodesicActiveContour = @@ -1548,7 +1553,12 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d //thresholder->SetInput( zeroCrossing->GetOutput() ); thresholder->SetInput( geodesicActiveContour->GetOutput() ); connector2->SetInput( thresholder->GetOutput() ); - + +<<<<<<<<<<<<<<<<<<< +*/ + + + smoothing->SetTimeStep( 0.125 ); smoothing->SetNumberOfIterations( 5 ); @@ -1624,7 +1634,6 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d vtkstripper->Update(); vtkstripper->UpdateInformation(); - vtkPolyData* polyDataResult = cntVTK->GetOutput(); //std::cout<<"Points "<GetNumberOfPoints()<Update( ); @@ -1797,7 +1806,8 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d } // if sizeCtrPt - +/* +//EED10JUIN2011 WriterType::Pointer writer = WriterType::New(); CastFilterType3::Pointer caster = CastFilterType3::New(); @@ -1847,6 +1857,7 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d caster5->SetOutputMinimum( 0 ); caster5->SetOutputMaximum( 255 ); writer5->Update(); +*/ } catch( itk::ExceptionObject & excep ) { @@ -2320,35 +2331,25 @@ void wxContourMainFrame::onSpreadAdd(){ void wxContourMainFrame::onSpreadAddAll(){ - printf("EED wxContourMainFrame::onSpreadAddAll \n"); //EED02 - std::vector tempVector; _instantPanel->getInstant( tempVector ); - int minZ,maxZ; minZ = 0; maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); - int z; int sizeLstContourThings; - for ( z=minZ ; z<=maxZ ; z++ ) { tempVector[1]=z; Instant instant(&tempVector); std::vector lstContourThings = kernelManager->getOutlinesAtInstant( &instant ); sizeLstContourThings = lstContourThings.size(); - - printf("EED wxContourMainFrame::onSpreadAddAll z=%d size=%d\n",z,sizeLstContourThings); - if (sizeLstContourThings>=1) { - std::vector vecX; std::vector vecY; std::vector vecZ; - ContourThing **contourthing = lstContourThings[0]; manualBaseModel *cModel = (*contourthing)->getModel(); int i,size = cModel->GetNumberOfPointsSpline(); @@ -2359,17 +2360,11 @@ void wxContourMainFrame::onSpreadAddAll(){ vecX.push_back(x); vecY.push_back(y); vecZ.push_back(z); - } - + } // for i std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector); interfMainPanel::getInstance()->appendStringSpread(val); - - printf("EED wxContourMainFrame::onSpreadAddAll -> val=%s\n",val.c_str() ); - - } - - } - + }// if sizeLstContourThings + } // for z } @@ -2998,44 +2993,41 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value) { - std::string temp = directory + "/" + namefile + "-Value.mhd"; + double spc[3]; + kernelManager->GetSpacing(spc,0); // returns the spacing of the first image + + std::string temp = directory + "/" + namefile + "-image-Value.mhd"; wxString filename = crea::std2wx(temp); - // LG - // filename.Printf(_T(temp.c_str())); - //filename.Printf(_T("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z); - /*filename.Printf(_T("%s"),directory.c_str()); - filename.append(_T("\\")); - filename.append(_T("%s"),namefile.c_str()); - filename.append(_T("-Value.mhd"));*/ // Image Value + + vtkImageChangeInformation *valueChInfo = vtkImageChangeInformation::New(); + valueChInfo->SetInput(value); + valueChInfo->SetSpacingScale(spc); vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( ); - writerValueImage->SetInput( value ); - writerValueImage->SetInput( value ); + writerValueImage->SetInput( valueChInfo->GetOutput() ); writerValueImage->SetFileName( (const char *)filename.mb_str() ); writerValueImage->SetFileDimensionality( 3 ); writerValueImage->SetCompression(false); writerValueImage->Write( ); // Image Mask - // filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z); - temp = directory + "/" + namefile + "-Mask.mhd"; + temp = directory + "/" + namefile + "-image-Mask.mhd"; // LG 14/01/09 : using crea filename = crea::std2wx(temp); // filename.Printf(_T(temp.c_str())); - /*filename.Printf(_T("%s"),directory.c_str()); - filename.append(_T("\\")); - filename.append(_T("%s"),namefile.c_str()); - filename.append(_T("-Mask.mhd"));*/ + vtkImageChangeInformation *maskChInfo = vtkImageChangeInformation::New(); + maskChInfo->SetInput(mask); + maskChInfo->SetSpacingScale(spc); vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( ); - writerMaskImage->SetInput( mask ); + writerMaskImage->SetInput( maskChInfo->GetOutput() ); writerMaskImage->SetFileName( (const char *)filename.mb_str() ); writerMaskImage->SetFileDimensionality( 3 ); - writerValueImage->SetCompression(false); + writerMaskImage->SetCompression(false); writerMaskImage->Write( ); interfMainPanel::getInstance()->setStringInfoPanel( _T("") );