[ITK] [ITK-users] Geodesic Shape Guidance in Python
Robert
scorpiuni at gmail.com
Tue Apr 26 05:34:29 EDT 2016
Hello,
I tried to implement a segmentation algorithm with shape guidance in Python,
while following a few C++ examples.
I encountered 2 Problems:
This Code creates a C++ Vector( shapeModeImages) containing the Modes
obtained via PCA:
std::vector<InternalImageType::Pointer> shapeModeImages( numberOfPCAModes
);
itk::NumericSeriesFileNames::Pointer fileNamesCreator =
itk::NumericSeriesFileNames::New();
fileNamesCreator->SetStartIndex( 0 );
fileNamesCreator->SetEndIndex( numberOfPCAModes - 1 );
fileNamesCreator->SetSeriesFormat( argv[15] );
const std::vector<std::string> & shapeModeFileNames =
fileNamesCreator->GetFileNames();
for (unsigned int k = 0; k < numberOfPCAModes; ++k )
{
ReaderType::Pointer shapeModeReader = ReaderType::New();
shapeModeReader->SetFileName( shapeModeFileNames[k].c_str() );
shapeModeReader->Update();
shapeModeImages[k] = shapeModeReader->GetOutput();
}
shape->SetMeanImage( meanShapeReader->GetOutput() );
shape->SetPrincipalComponentImages( shapeModeImages );
I tried to write this in Python :
shapeModeImages = []
fileNamesCreator = itk.NumericSeriesFileNames.New()
fileNamesCreator.SetStartIndex(0)
fileNamesCreator.SetEndIndex(numberOfPCAModes-1)
fileNamesCreator.SetSeriesFormat('CorpusCallosumMode')
shapeModelFileNames = fileNamesCreator.GetFileNames()
for k in range(0, numberOfPCAModes):
shapeModeReader = ReaderType.New()
shapeModeReader.SetFileName(shapeModelFileNames[k]+'%s.mha' %k)
shapeModeReader.Update()
shapeModeImages.append(shapeModeReader.GetOutput())
But now, when I call
shape.SetPrincipalComponentImages(shapeModeImages)
I get the following error:
TypeError: in method
'itkPCAShapeSignedDistanceFunctionD2IF2_SetPrincipalComponentImages',
argument 2 of type 'std::vector< itkImageF2_Pointer,std::allocator<
itkImageF2_Pointer > >'
It seems like I can't use a list to pass the Images... Is there a workaround
available, or simply another structure?
Second thing ( I did not have a look into this yet):
How do I translate this to Python? I can't see a Solution here immediately,
but like I said, I did not look into this yet:
ShapeFunctionType::ParametersType pcaStandardDeviations( numberOfPCAModes
);
pcaStandardDeviations.Fill( 1.0 );
Thanks for any Input,
Robert
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Geodesic-Shape-Guidance-in-Python-tp7588780.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list