150 likes | 300 Views
Read a DICOM File. typedef unsigned char InputPixelType; const unsigned int InputDimension = 2; typedef itk::Image<InputPixelType, InputDimension> InputImageType; typedef itk::ImageFileReader<InputImageType> ReaderType; typedef itk::GDCMImageIO ImageIOType;
E N D
Read a DICOM File typedef unsigned char InputPixelType; const unsigned int InputDimension = 2; typedef itk::Image<InputPixelType, InputDimension> InputImageType; typedef itk::ImageFileReader<InputImageType> ReaderType; typedef itk::GDCMImageIO ImageIOType; ReaderType::Pointer reader = ReaderType::New(); ImageIOType::Pointer gdcmImageIO = ImageIOType::New(); reader->SetFileName(lpszPathName); reader->SetImageIO(gdcmImageIO); reader->Update();
Write a DICOM File typedef unsigned char OutputPixelType; const unsigned int OutputDimension = 2; typedef itk::Image<OutputPixelType, OutputDimension> OutputImageType; typedef itk::ImageFileWriter< OutputImageType > WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetFileName("D:\\test.jpg"); writer->SetInput( reader->GetOutput() ); writer->Update();
Rescale typedef itk::RescaleIntensityImageFilter< InputImageType, OutputImageType > FilterType; FilterType::Pointer filter = FilterType::New();
Binary Threshold typedef itk::BinaryThresholdImageFilter< InputImageType, InputImageType > FilterType2; FilterType2::Pointer filter2 = FilterType2::New(); filter2->SetOutsideValue(0); filter2->SetInsideValue(1200); filter2->SetLowerThreshold(800); filter2->SetUpperThreshold(1200);
DiConverter • Input • DICOM file(s) • Output • RAW Data • JPG/PNG • Exe file • Console • argc / argv • Windows (MFC)
DiConverter • Deadline • 2007/04/24 (Tue.) • Grading • Results • 60% • Manual • 30% • Miscel. (coding practice) • 10%
Access Pixel Data InputImageType::Pointer ptrImage = reader->GetOutput(); reader->Update(); InputImageType::IndexType pixelIndex; pixelIndex[0] = 0; pixelIndex[1] = 0; InputImageType::PixelType pixelValue = ptrImage->GetPixel(pixelIndex);
CPathDialog and CFileFinder CPathDialog dialog("目錄對話盒元件範例","選取目錄","D:\\"); if ( dialog.DoModal() == IDOK ) { CString strFolder; strFolder=dialog.GetPathName(); AfxMessageBox(strFolder); CFileFinder Finder(strFolder); Finder.FindAllFiles("*.*"); for (int i=0; i<Finder.GetSize(); i++) AfxMessageBox(Finder.GetPath(i)); }
Metadata • Metadata • Data about data
DICOM File • Header • Tag • (group number, element number) • Patient’s age: (0010, 0010) • Patient’s sex: (0010, 0040)
ITK Software Guide • 7.12.5 • Printing DICOM Tags From One Slice
Topics for Final Project (I) • Thresholding • Edge Detection • Casting and Intensity Mapping • Gradients • Second Order Derivatives • Neighborhood Filters • Mean Filter & Median Filter
Topics for Final Project (II) • Thresholding • Edge Detection • Casting and Intensity Mapping • Gradients • Second Order Derivatives • Neighborhood Filters • Mean Filter & Median Filter • Morphology and Voting Filters
Topics for Final Project (II) • Smoothing • Blurring and Local Blurring • Edge Preserving Smoothing • Frequency Domain • Extracting Surfaces