| 457 | |
| 458 | template< typename TImageType > |
| 459 | static void itkInsertLabel(TImageType * maskImage, mitk::Image::Pointer & outimage, unsigned int label) |
| 460 | { |
| 461 | |
| 462 | typename TImageType::Pointer itk_out; |
| 463 | |
| 464 | if(outimage.IsNull()) // create if necessary |
| 465 | { |
| 466 | MITK_INFO << "Initialize new image"; |
| 467 | itk_out = TImageType::New(); |
| 468 | itk_out->SetSpacing(maskImage->GetSpacing()); |
| 469 | itk_out->SetDirection(maskImage->GetDirection()); |
| 470 | itk_out->SetOrigin(maskImage->GetOrigin()); |
| 471 | itk_out->SetRegions(maskImage->GetLargestPossibleRegion()); |
| 472 | itk_out->Allocate(); |
| 473 | itk_out->FillBuffer(0); |
| 474 | }else |
| 475 | { |
| 476 | mitk::CastToItkImage(outimage, itk_out); |
| 477 | } |
| 478 | |
| 479 | itk::ImageRegionIterator<TImageType> oit(itk_out,itk_out->GetLargestPossibleRegion()); |
| 480 | itk::ImageRegionConstIterator<TImageType> mit(maskImage,maskImage->GetLargestPossibleRegion()); |
| 481 | |
| 482 | while(!mit.IsAtEnd()) |
| 483 | { |
| 484 | if(mit.Value() != 0) |
| 485 | { |
| 486 | oit.Set(label); |
| 487 | } |
| 488 | ++oit; |
| 489 | ++mit; |
| 490 | } |
| 491 | |
| 492 | mitk::CastToMitkImage(itk_out,outimage); |
| 493 | } |
| 494 | |
| 495 | |
| 496 | template< typename TImageType > |
nothing calls this directly
no test coverage detected