Giter Club home page Giter Club logo

itkgrowcut's Introduction

ITKGrowCut

Build Status

PyPI Version

License

Overview

ITKGrowCut is a remote module for ITK. The main filter segments a 3D image from user-provided seeds.

The original idea was presented by Vezhnevets and Konouchine:

Vladimir Vezhnevets and Vadim Konouchine:
“GrowCut” – interactive multi-label N-D image segmentation by cellular automata.
In: Proc. Graphicon. (2005) 150–156

In 2011 Harini Veeraraghavan of Memorial Sloan Kettering Cancer Center provided an implementation based on ITK.

In 2014, Zhu et al. presented an efficient approximation:

Liangjia Zhu, Ivan Kolesov, Yi Gao, Ron Kikinis, Allen Tannenbaum.
An Effective Interactive Medical Image Segmentation Method Using Fast GrowCut
International Conference on Medical Image Computing and Computer Assisted Intervention (MICCAI),
Interactive Medical Image Computing Workshop, 2014

Zhu et al. also provided an open source implementation as a Slicer plugin, based on VTK. Since then, their implementation was integrated into Slicer, refactored and improved. In this remote module we are building upon the improved variant from Slicer.

Acknowledgements

This software was developed in part by the Center for Integrative Biomedical Computing (CIBC), the Scientific Computing and Imaging (SCI) Institute and Kitware.

Support came from the National Institute of General Medical Sciences (NIGMS) of the National Institutes of Health (NIH) under grant numbers P41 GM103545 and R24 GM136986.

itkgrowcut's People

Contributors

dzenanz avatar hjmjohnson avatar jhlegarreta avatar kian-weimer avatar tbirdso avatar thewtex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

itkgrowcut's Issues

How to build ITKGrowCut?

Since ITKGrowCut is a remote module for ITK, should I put ITKGrowCut into to ITK/Modules/ThirdParty or implement a GrowCut.remote.cmake by myself?

I have directly build ITKGrowCut, but it failed to find GrowCut in CMake:

find_package(GrowCut)
or
find_package(ITKGrowCut)

How to accelerate ITKGrowCut

Hi, I used ITKGrowCut test code with my data, and
it worked, but very slow. My data_size is 512x512x785, and i need take 3-4 minutes to process it. May i ask you how to accelerate it?

my test code is:

#include <iostream>
#include <string>
#include "itkFastGrowCut.h"
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"


int main(int argc, char* argv[])
{
	const char* inputImage = "E:\\HCM\\DATASET\\itkgrwocut\\image.nii.gz";
	const char* seedsImage = "E:\\HCM\\DATASET\\itkgrwocut\\seed.nii.gz";
	const char* noisyLabels = "E:\\HCM\\DATASET\\itkgrwocut\\label.nii.gz";

	constexpr unsigned int Dimension = 3;
	using PixelType = short;
	using ImageType = itk::Image<PixelType, Dimension>;
	using LabelType = itk::Image<unsigned char, Dimension>;

	using FGCType = itk::FastGrowCut<ImageType, LabelType>;
	FGCType::Pointer fgcFilter = FGCType::New();
	// Read the images
	typedef itk::ImageFileReader<ImageType> ReaderType;
	ReaderType::Pointer reader = ReaderType::New();
	reader->SetFileName(inputImage);
	reader->Update();
	ImageType::Pointer image = reader->GetOutput();
	typedef itk::ImageFileReader<LabelType> ReaderType2;
	ReaderType2::Pointer reader2 = ReaderType2::New();
	reader2->SetFileName(seedsImage);
	reader2->Update();
	LabelType::Pointer seeds = reader2->GetOutput();

	// Filter the original, possibly noisy image
	fgcFilter->SetInput(image);
	fgcFilter->SetSeedImage(seeds);
	fgcFilter->Update();

	using WriterType = itk::ImageFileWriter<LabelType>;
	WriterType::Pointer writer = WriterType::New();
	writer->SetInput(fgcFilter->GetOutput());
	writer->SetFileName(noisyLabels);
	writer->Update();
	std::cout << "Test finished." << std::endl;
	return EXIT_SUCCESS;
}

the inputimage and seed are:

1691034070144
1691034127358

Can not successfully build ITKGrowCut

I want to use ITKGrowCut in my project, but there are some trouble to build it.

Firstly, I can successfully compile it. But when I include the itkFastGrowCut.h, a bug is reported:

1. can not open "itkPrintHelper.h"
2. missing type specifier- int assumed. Note: C++ does not support default-int

The second bug is located at: ITK_DISALLOW_COPY_AND_MOVE(FastGrowCut); (itkFastGrowCut).

Then, I re-compile the ITK, and turn the Build_Testing on, and more bugs are reported:

1. can not open `itkImageRegionIterator.h`
2. can not open `itkImageRegionIteratorWithIndex.h`
3. can not open `itkNumericTraits.h`
4. can not open `itkRegionOfInterestImageFilter.h`
5. can not open `GrowCutExport.h`
6. can not open `itkImageToImageFilter.h`
7. can not open `itkPrintHelper.h`
8. identifier 'LabPixelType` is not defined.
9. identifier `SrcPixelType` is not defined
...

All the above bugs is reported from GrowCut-all project.

My environment is:

win 10
vs 2019
cmake 3.20.4
ITK: 4.13.3

How to provide background seed point for ITKGrowCut?

I can compile ITKGrowCut, and successfully run it. But the result is not good.

image

In the above figure, the left is the result from ITKGrowCut and the right is the result from geodesic segmentation.

The result from ITKGrowCut is poor, and I want to know:

  1. how to set the seed point for background? I can only set seed point for foreground by: fgcFilter->SetSeedImage(foregroundMaskReader->GetOutput());.

  2. what should be the image for seed point? The pixel of none seed point should be 0, what's the value for the pixel of seed point? 1 or 255?

how to use ITKGrowCut

hi,i want use ITKGrowCut in my project,i modify the test code,the program like this:

#include <iostream>
#include "itkFastGrowCut.h"

#include "itkCommand.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkMedianImageFilter.h"
#include "itkTestingMacros.h"


int main(int argc, char* argv[])
{
	const char* inputImage = "D:\\roi_image_sitk.nii.gz";
	const char* seedsImage = "D:\\seedsimagesitk.nii.gz";
	const char* noisyLabels = "growcut.nii.gz";

	constexpr unsigned int Dimension = 3;
	using PixelType = short;
	using ImageType = itk::Image<PixelType, Dimension>;
	using LabelType = itk::Image<unsigned char, Dimension>;

	using FGCType = itk::FastGrowCut<ImageType, LabelType>;
	FGCType::Pointer fgcFilter = FGCType::New();
	// Read the images
	typedef itk::ImageFileReader<ImageType> ReaderType;
	ReaderType::Pointer reader = ReaderType::New();
	reader->SetFileName(inputImage);
	reader->Update();
	ImageType::Pointer image = reader->GetOutput();
	typedef itk::ImageFileReader<LabelType> ReaderType2;
	ReaderType2::Pointer reader2 = ReaderType2::New();
	reader2->SetFileName(seedsImage);
	reader2->Update();
	LabelType::Pointer seeds = reader2->GetOutput();

	// Filter the original, possibly noisy image
	fgcFilter->SetInput(image);
	fgcFilter->SetSeedImage(seeds);
	fgcFilter->Update();

	using WriterType = itk::ImageFileWriter<LabelType>;
	WriterType::Pointer writer = WriterType::New();
	writer->SetInput(fgcFilter->GetOutput());
	writer->SetFileName(noisyLabels);
	writer->Update();
	std::cout << "Test finished." << std::endl;
	return EXIT_SUCCESS;
}

image and seed mask image is this:
捕获
the program can get result,but the result is same with seedsimagesitk,don't have any binary mask image.
maybe some wrong with my input image and seed mask,can you share example how to use it?

thank you
chenjunqiang

Question about GrowCut

I have successful run the ITKGrowCut with the provided data, and the result is good.

Then, I test the ITKGrowCut with my own data, and the result is:

image

The shown figure is: original image (left), seed point for object and background (middle), and result from grow cut (right).

The zoom in seed point and grow cut result is:

image

We can see that the grow cut result is poor, which just copy the seed point.

In the provided demo data, many seeds is provided. But in my data, I only provide very few seed point, where pixel of 1 indicates ventricle and pixel of 2 indicates the background. Is the poor grow cut result caused by the few seed points?

COMP: Many compiler warnings

[277/278] Building CXX object Modules/Remote/GrowCut/test/CMakeFiles/GrowCutTestDriver.dir/itkFastGrowCutTest.cxx.o
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/test/itkFastGrowCutTest.cxx:19:
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:197:
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:99:17: warning: declaration shadows a field of 'FastGrowCut<TInputImage, TLabelImage, TMaskImage>' [-Wshadow]
  NodeIndexType m_DimX = region.GetSize(0);
                ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:181:17: note: previous declaration is here
  NodeIndexType m_DimX;
                ^
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/test/itkFastGrowCutTest.cxx:19:
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:197:
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:100:17: warning: declaration shadows a field of 'FastGrowCut<TInputImage, TLabelImage, TMaskImage>' [-Wshadow]
  NodeIndexType m_DimY = region.GetSize(1);
                ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:182:17: note: previous declaration is here
  NodeIndexType m_DimY;
                ^
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/test/itkFastGrowCutTest.cxx:19:
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:197:
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:101:17: warning: declaration shadows a field of 'FastGrowCut<TInputImage, TLabelImage, TMaskImage>' [-Wshadow]
  NodeIndexType m_DimZ = region.GetSize(2);
                ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:183:17: note: previous declaration is here
  NodeIndexType m_DimZ;
                ^
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/test/itkFastGrowCutTest.cxx:19:
In file included from /Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:197:
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:295:24: warning: declaration shadows a local variable [-Wshadow]
    LabelPixelType *   resultLabelVolumePtr = resultLabelVolume->GetBufferPointer();
                       ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:288:30: note: previous declaration is here
  LabelPixelType *           resultLabelVolumePtr = resultLabelVolume->GetBufferPointer();
                             ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:382:16: warning: unused variable 'compareTolerance' [-Wunused-variable]
  const double compareTolerance = (spacing[0] + spacing[1] + spacing[2]) / 3.0 * 0.01;
               ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.hxx:377:14: warning: unused variable 'seedImage' [-Wunused-variable]
  auto       seedImage = this->GetSeedImage();
             ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/include/itkFastGrowCut.h:69:15: note: in instantiation of member function 'itk::FastGrowCut<itk::Image<short, 3>, itk::Image<unsigned char, 3>, itk::Image<unsigned char, 3> >::GenerateData' requested here
  itkNewMacro(Self);
              ^
/Users/johnsonhj/Dashboard/src/ITK/Modules/Remote/GrowCut/test/itkFastGrowCutTest.cxx:78:41: note: in instantiation of member function 'itk::FastGrowCut<itk::Image<short, 3>, itk::Image<unsigned char, 3>, itk::Image<unsigned char, 3> >::New' requested here
  FGCType::Pointer fgcFilter = FGCType::New();
                                        ^
6 warnings generated.
[278/278] Linking CXX executable bin/GrowCutTestDriver

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.