Ejemplo n.º 1
0
void SeriesReader::readSeriesData(unsigned int minSlices) {
	nameGenerator->SetUseSeriesDetails( true );
	nameGenerator->SetDirectory( inputDir );
	typedef std::vector< std::string > SeriesIdContainer;
	const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
	SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
	SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
	while( seriesItr != seriesEnd )	{
		FileNamesContainer fileNames = nameGenerator->GetFileNames(seriesItr->c_str());
		if (fileNames.size() >= minSlices) 
			slist.push_back( fileNames );
		seriesItr++;
	}
}
Ejemplo n.º 2
0
SeriesFilelist getSeriesFileNames(const std::string &inputDir, unsigned int minSlices) {
	NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
	nameGenerator->SetUseSeriesDetails( true );
	nameGenerator->SetDirectory( inputDir );
	SeriesFilelist slist;

	typedef std::vector< std::string > SeriesIdContainer;
	const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
	SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
	SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
	while( seriesItr != seriesEnd )	{
		FileNamesContainer fileNames = nameGenerator->GetFileNames(seriesItr->c_str());
		if (fileNames.size() >= minSlices) 
			slist.push_back( fileNames );
		seriesItr++;
	}

	return slist;
}
Ejemplo n.º 3
0
bool ITKImplicit::loadDicom(const std::string & directory)
{
	nameGenerator->SetInputDirectory( directory.c_str() );
	
	typedef std::vector< std::string >   FileNamesContainer;
	FileNamesContainer fileNames;
	fileNames = nameGenerator->GetInputFileNames( );
	unsigned int numberOfFilenames =  fileNames.size();

	for(unsigned int fni = 0; fni<numberOfFilenames; fni++)
	{
		std::cout << "filename # " << fni << " = ";
		std::cout << fileNames[fni] << std::endl;
	}
	
	reader->SetFileNames( fileNames );
		
	try
	{
		reader->Update();		
	}
	catch (itk::ExceptionObject &excp)
	{
		std::cerr << "Exception thrown while reading the image" << std::endl;
		std::cerr << excp << std::endl;
	
		return false;
	}
	
	// 
	// At this point we would have the volumetric data loaded in memory and we can
	// get access to it by invoking the \code{GetOutput()} method in the reader.
	//
	myImage = reader->GetOutput();		
	return true;
}