2017-08-18 15 views
0

私はDICOM画像(CTスキャン)&に取り組んでいます。人間の臓器(大動脈のように、画像が囲まれています)のような私の画像に関心のある構造を分離したいと考えています。私はITK & VTKの助けを借りてC++でコーディングしています。領域成長アルゴリズムを使用して関心領域を定義するには?

The bright tube describes a sick aorta and corresponds to the structure that I would like to isolate.

従って、私は自動的に領域成長アルゴリズム(以下のコード)を使用してそれらを識別することができる、のは、これらの器官は、特定の輝度強度を有すると仮定する。そうするために、私は以前に、器官に属するボクセルの平均値&の標準偏差値に基づいていくつかの閾値を計算した。

ITK/VTK機能の助けを借りて、大動脈を画像に保存するにはどうしたらよいですか?私が探しているのは、ITK mask image filterとは正反対のフィルタです。

以下の器官の分離に対応する(疑似)コードを見つけてください。私は、臓器のすべてのボクセルを確実に含むように、そしてクロッピング後に器官の周りに十分なマージンを持たせるために、領域成長の結果について5ボクセルの膨張を計算した。

typedef short InputPixelType; 
typedef unsigned char OutputPixelType; 
const int Dimension = 3; 

typedef itk::Image< InputPixelType, Dimension > InputImageType; 
typedef itk::Image< OutputPixelType, Dimension > OutputImageType; 

// Region growing 
typedef itk::ConnectedThresholdImageFilter< InputImagetype, 
OutputImagetype > ConnectedFilterType; 

ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New(); 

connectedThreshold->SetInput(input); 
connectedThreshold->SetUpper(upperThreshold); 
connectedThreshold->SetLower(lowerThreshold); 

//Initializing seed 
InternalImagetype::IndexType index; 
index[0] = seed_x; 
index[1] = seed_y; 
connectedThreshold->SetSeed(index); 

// Dilate the resulting region-growing of 5 voxels for safety 
typedef itk::BinaryBallStructuringElement< OutputImageType, 
Dimension > StructuringElementType; 
typedef itk::BinaryDilateImageFilter< OutputImageType, 
OutputImageType, StruturingElementType > DilateFilterType; 

StructuringElementType structuringElement; 
structuringElement.SetRadius(5); 
structuringElement.CreateStructuringElement(); 

DilateFilterType::Pointer dilateFilter = DilateFilterType::New(); 
dilateFilter->SetInput(connectedThreshold->GetOutput()); 
dilatefilter->SetKernel(structuringElement); 

// Saving the results of the RG+dilation 
typedef itk::ImageFileWriter<OutputImageType> WriterType; 
WriterType::Pointer writer = WriterType::New(); 
writer->SetInput(dilateFilter->GetOutput()); 
writer->SetFileName("organ-segmented-with-dilation.mhd"); 
try { 
    writer->Update(); 
} catch(itk::ExceptionObject& err) { 
    std::cerr << "Exception caught! " << err.what() << std::endl; 
    return EXIT_FAILURE; 
} 

// What to do next to crop the input image with this region-growing? 

何か助けや挨拶は歓迎されます。

答えて

0

記録のために、私はITK mask negated filterを使用して問題を解決しましたが、これは基本的なマスクフィルタに反して直接問題に答えるものです。

1

Mask filter自体は、通常とは逆の動作をします。デフォルトでは、マスキング値は0で、値も外です。これは、マスクの非ゼロ部分に対応する画像の部分が保持され、残りがゼロにされることを意味する。これがあなたが望むものでなければ、異なるマスキングと外の値を設定することで簡単にロジックを反転させることができます。

+0

実際に私が探していたものをexacltyするitkMaskNegatedImageFilterが見つかりました。私はあなたが提案したことについても考えましたが、それをすることはできませんでした。理由はわかりません。ご回答有難うございます。 – avazula

+0

答えに投票したり、解決策としてマークしたりしますか? –

関連する問題