+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
//----------------------------------------------------------------------------------------------------------------
// Class definition include
//----------------------------------------------------------------------------------------------------------------
//DefinciÛn de conexiÛnes entre VTK e ITK y el writer
typedef itk::VTKImageToImageFilter<OutputImageType2> ConnectorType;
typedef itk::ImageToVTKImageFilter<OutputImageType> ConnectorType2;
- typedef itk::ImageFileWriter< OutputImageType > WriterType;
+//EED10JUIN2011 typedef itk::ImageFileWriter< OutputImageType > WriterType;
ConnectorType::Pointer connector= ConnectorType::New();
ConnectorType2::Pointer connector2= ConnectorType2::New();
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 =
//thresholder->SetInput( zeroCrossing->GetOutput() );
thresholder->SetInput( geodesicActiveContour->GetOutput() );
connector2->SetInput( thresholder->GetOutput() );
-
+
+< - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < -
+*/
+
+
+
smoothing->SetTimeStep( 0.125 );
smoothing->SetNumberOfIterations( 5 );
vtkstripper->Update();
vtkstripper->UpdateInformation();
-
vtkPolyData* polyDataResult = cntVTK->GetOutput();
//std::cout<<"Points "<<polyDataResult->GetNumberOfPoints()<<std::endl;
polyDataResult->Update( );
} // if sizeCtrPt
-
+/*
+//EED10JUIN2011
WriterType::Pointer writer = WriterType::New();
CastFilterType3::Pointer caster = CastFilterType3::New();
caster5->SetOutputMinimum( 0 );
caster5->SetOutputMaximum( 255 );
writer5->Update();
+*/
}
catch( itk::ExceptionObject & excep )
{
void wxContourMainFrame::onSpreadAddAll(){
- printf("EED wxContourMainFrame::onSpreadAddAll \n");
//EED02
-
std::vector<int> 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<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
sizeLstContourThings = lstContourThings.size();
-
- printf("EED wxContourMainFrame::onSpreadAddAll z=%d size=%d\n",z,sizeLstContourThings);
-
if (sizeLstContourThings>=1)
{
-
std::vector<double> vecX;
std::vector<double> vecY;
std::vector<double> vecZ;
-
ContourThing **contourthing = lstContourThings[0];
manualBaseModel *cModel = (*contourthing)->getModel();
int i,size = cModel->GetNumberOfPointsSpline();
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
}
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("") );