基于ITK、VTK与MFC读取DICOM图像
基于ITK,VTK以及MFC读取DICOM图像的文献@ErtoRwww.crter.org吕哧琪,等于1K、K和MC的DCOM图像读写及显示文章是在视类的构造函数及其析构函数中实现它们的初始化及善后工作的。其次,改写视图类的虚函数Ocrea(),以下为关键代码ren Win->AddRenderer(ren);renWin->Setwindowld(m hWnd)iren->SetRenderWindow(ren Win)最后,在视图类的 OnDraw函数中添加绘制代码Render()当然窗口的尺寸也可以在这里进行调整。Figure 5 Unintegrated display effect此,可以在MFc应用稈序视图区域中实现与VTK图5未集成显示效果渲染对象的父互和鼠标响应操作,并可以利用MFC界面控件来进行参数控制,本文程序中鼠标按下会弹出一个对于VTK与MFC的集成已有相关文献介绍,分为快显示图像上象素坐标及象素值的消息框(见图7,8)借以速集成和深度集成两种集成方式。图6是作者将图5对应说明鼠标响应交互操作的实现,至此完成了TK与MFC序做了怏速集成后 DICOMA像的显示。集成过程只需的深度集成。读者也可以参考ⅤTK工具包 Examples设置 vtk RenderWindow类中的 SetParent函数为当前 GUlIn32MFC下的例程,实现更丰富的集成。该视图或对话框句柄即可,关键代码如下所示和集环覓下的面显示将结合后续DCOM文件显示tkRenderwindow部分给出。FrenWin=vtkRenderWindow: NewovtkRenderWindowlnteractoriren=vtkRenderWindowInteractor Newothis->renWin->SetParentld(this->m hWnd);this->iren->SetRenderWindow(this->renIn);Figure 7 Display effect of vik depth integration图7深度集成环境下VTK显示效果Figure 6 Display effect of fast integration图6快速集成显示效果快速集成屏蔽」MFC的鼠标响应和消息传递,不便于后续编程实现更复杂的功能。VTK与MFC集成的请为:0007000根本目的是实现更实用、更灵活的交互界面,以弥补VTK自身在该方面的缺憾,那么就要求不仅要将TK的渲染窗口嵌入于MFC应用程序视图区域,而且还要Figure 8 Display effect after flipping图8翻转后VTK显小效果使其融为一体,即拥有一个统一的具有友好交互能力的界面。在此,重点介绍下作者尝试实现VTK与MFC深度集成的另一种方法,具体步骤如下:首先,在视类中增2D|cOM图像的读写与显示加可视化管道中会用到的类,用这些类实例化对象,文章用到的对象有:渲染对象ren)、渲梨窗口( renin)、2.1DCOM图像的读写文章中的数据对象是一维交互对象(ren)、演员( BrainActor)、映射( Brain Map)等, DICOM图像。读与DCOM文件的功能使用∏TK提供的范o1994-2011ChinaAcadcmicJournalElcctronicPublishingHousc.Allrightsroscrved.http://www.cnki.nctcn.zglckf.com2418P.O. Box 1200, Shenyang 110004吕烧琪,等干K、VTK和MFC的DCOM图像读写及显示CRTOR Ww. cRTER org函功能来实现,在∏K中,DCOM的范函性由GDCM厍写DcOM文件是一件非常精密的操作,因为所要处理的提供。这个开放的源码厍由INSA_Lyon的 creats团队发是大量重要的有关患者详细而精确的数据,并且涉及到展的。实验使用: GDCMImagelO类来建立与GDCM库患者的隐私问题。所以在写的过程中,一定要核实出你的连接,实现读取 DICOM图像的功能。|TK数据处理管的代码所生成的头文件信息不会给患者的治疗和诊断道中的三种处理对象具休为:Sσurce采用带来风险,要确休沿着数据处珄管道正桷地传递DC○Mik: itklmage SeriesReader类; Filter来用了ik∷文件的细节信息,从而才能保证正确地将原D|COM文件Curvature FlowImage Filter; Mapper采用了itk:的这些信息写入新的DcOM序列图像文件。以下便是实itkImageFileWriter类。现该部分内容的主要代码:单张二维DCOM图像的读写:本部分实现单张二维首先定义图像类型,并明确所选象素类型和维度,p|c○M图象以 DICOM格式读入与以DCOM格式写入从而定义序列图像读取类型。的工作。首先声明象素类型和图像的维数,以它们作为typedef signed short PixelType模板参数来实例化读入图像的类型,用该图像类型作为const unsigned int Dimension=3;模板参数再实例化读取器 Reader的类型并创建一个typedef itk: Image< PixelType, DimensionReader,将读入图像的文件路径和文件名作为参数传给 mage Type;Reader,并为 Reader关联 GDCMImagelO对象,调用typedef itk: Image SeriesReader< Image TypeUpdate(函数更新读取过程,DcOM图像就已读入内存 ReaderType中。用 Reader的 Getoutput()方法可以获得图像数据的接下来声明并实例化实际读写DCOM图像的指针。月前的焦点是如何再一次将图像在新文件中保存k: GD CMImagelC对象和为所有切片生成文件名并排成DCOM格式。具体的,先实例化一个 Image File Writer序的tk: GDCMSeries fileNames对象,并创建相应智能类型,并创建指针 Writer,将写入的图像的文件路径和指针 gdcmIO和 names Generator。文件名作为参数传给 Writer,并为其关联ImageloType: PointerGDCM| magelo对象,这个对象是知道DCOM格式的内 gdcmIo= magelOType:New()部结构的,最后用 Update()来触发写入程序。文章在读Names Generator Type: Pointer写过稈中对图像进行了保留边缘的平滑去噪处珥,以下 names Generator= Names GeneratorType:|New()为主要代码names Generator->SetInputDirectory(argvImageloType: Pointer生成读入文件的文件名gdcmImagelo=ImageloType: NeW(const ReaderType: FileNames Containerreader->Setlmagelo(gdcmImagelO)filenames=namesGenerator->GetInput FileNames():reader> SetFileName(argv):∥参数为文件路径实例化 Reader Type对象并创建智能指针 reader,读及文件名取DcOM格式序列图像。writer->Setlmagelo(gdcmImagelO)reader->Setlmagelo(gdcmlO)rwriter->SetFileName(argv2);∥将平滑后图像以reader->SetFileNames(filenames )D|COM格式写入到参数所指定的文件中。最后用 reader的 Update()触发读取程序,最好放在try/catch问询块中,在此不再赘述。CurvatureFlowImageFilterType: Pointer至此,可以开始写数据了。首先把确定存在的输出smoother= rvatureFlowlmageFilterType:|New();∥目录传给 outputDirectory指针。实例化一个平滑滤波器的对象const char outputDirectory=argv;smoother-> SetNumberoflterations(5):W平滑滤波然后,实例化 SeriesWritertype对象并创建智能指器的迭代次数设为5针 series writer,将 reader的输出写为D|COM格式序列smoother-> SetTime Step(0.125);∥平滑滤波器的像时间步长设为0125series Writer->SetInput(reader->Getoutput()smoother->SetInput(reader->Getoutputo)series Writer->Setlmagelo(gdcmIO)writer->Setlnput(smoother->GetOutputO)现在可以设置 G DCMSeriesFileNames在至此完成DCOM单张图像的读写。outputDirectory下产生新的文件名,然后将最新生成的序列二维DCOM图像的读写:这部分}要实现以文件文件传递给 seriesWriter集的方式读取一个DCOM序列图像,并在保持头文件信namesGenerator->SetoutputDirectoryoutputDire息不变的情况下保存为另一个DCOM序列图像的工作。 ctory);/S SN 1673-8225 CN 21-1539/R CODEN: ZLKHAH2419C1994-2011ChinaAcadcmicJOurnalElcctronicPublishingHousc.Allrightsrcscrved.http://www.cnki.nct@RterwWw.crtEr. org吕晓琪,等基于1K、VK和MFC的DCOM图像读写及显示seriesWriter->SetFileNames(names Generator->GetOutputFileNames();3结论最后一步也是最关键的一步,用 reader读取MetaDataDictionary并传递给 seriesWriter。之所以关键TK是算法设计者的一个有力助手,是医学图像处是因为 Meta Data Dictionary包含」所有输入的DcoM理工作者的案例研究算法仓厍,遺憾的是不提供Ul文件的头文件。VTK软件开发包强大的图形处理和可视化功能,却缺乏seriesWriter> SetMetaData Dictionary Array( reade实用、灵活的交互界面,而MFC具有强大的U开发能力。r->GetMetaData DictionaryArray ()结合三者的特点,作者通过对DCOM医学图像的读取与末了调用 seriesWriter的 Update)触发写程序,放在显小,将TK、VTK和MFC有机的结合起来,扬长避短,try/catch问洵块中,在此不再赘述。为三者集成环境下的软件开发做了一个初步的尝试,而22DCOM图像的显示本部分主要介绍在前述方法对于在此基础之上一者更强大功能的实现(诸如医学图实现的∨TK、ITK和MFC集成环境卜DCoM图像的显示像的分割与准、三维可视化、虚拟手术导航等)有待方法。在此,将利用丨TK读取的DC○M文件用VTK显示深入探讨与研究。在MFC单文档视图区,因为旨在说明方法所以未给出复杂的交互界面。4参考文献VTK薮据处理管道中采用了vkD|cOM|mageReader:类、 teNderer类、 vtkRenderwindow类、[1 Kitware Inc. NLM Insight Segmentation and registration ToolkitEB/OL」2005.http:/www.itκOrgtkRenderwindowInteractor类、 traCtor2D类、[21 Ackerman MJ. the visible human project. Proceedings of thelEEE,1998;863):501-504.v+ < Mapper类,并实例化各个类的对象并创建相21/mD(Q小用m时应智能指针。图7为显示效果,相应关键代码如下计算机技术发,200816(4=515 NEMA. The DICOM standard. Technical report, NEMA,Brain Map->SetInput(vtkreader->Getoutput()http://medial.nemaorg,2004[61http:/www.itk.org/courseWare/training/gettIngstartedl-webpageBrainActor->SetMapper (BrainMap);ren->AddActor(BrainActor)http:ww.kitwvare.comiproducts/books/vtkquide.htmlBenoit Regrain EricBoix, Mathieu and Jean Pierre roux. the「TK所读取的图像一经VTK显示后图像发牛了翻GDCM Library. CNRS, INSERM, INSALyon, UCBLyonhttp://www-creatis.insa-lyon.fr/publIc/gdcm转,并且是上下翻转而左右并不发生翻转,原因是ITK的坐标系统和VTK的坐标系统Y轴是相反的,所以为了来自本文课题的更多信息能正确显示图像还需要将Y轴进行翻转,可见这种翻转墓金资助:国家自然科学基金资助项目(60761002)可以发生在两种情形,一种是在K读入图像的时候翻作耆贡:笫一作者进行实验设计及评估,实验实施转即改变文件的读取方式,该种方式可参考∏TK的为笫二作者,资料收集为笫三作者,第二作者成文,第FliplmageFilter类,该类可以实现翻转任何坐标轴中的作者审校并对文章负责图像,对于本文屮情形可以使用一个[0,们翻转排列,列益冲突:课题未涉及任何厂家及相关雇主或其灺经表示X轴保持不变时对Y轴进行翻转;另一种是在K图济组织直接或间接的经济或利益的赞助像薮据凵经转换为ⅥTK图像数据后将新的TK图像数本文创新性:于201101以文章关键词为检索关键词据Y轴鄱转,这也正是本文实现的图像翻转方法。相应在CNK丨欻捃库、维普中文科技期刊数据库、万方学位论关键代码:文全文数据库, ELSEVIER数据库等多个数据库中检索未flipY->SetFilteredAxis(1)见具有相同创新点文章flipY->SetInputConnection(vtkreader->Getoutput方法创新:为医学图像读写及显示后一系列的玉学Eort()像处理工作搭建了灵活实用的实验平台,进而得到相关基BrainMap->SetInput(flipY->GetOutput():金资助。以上便是集成环境下的D|COM图像显小。o1994-2011ChinaAcadcmicJournalElcctronicPublishingHousc.Allrightsroscrved.http://www.cnki.nctCn.zg/ckf.com2420P.O. Box 1200, Shenyang 110004
- 2020-12-01下载
- 积分:1
MATLAB在卡尔曼滤波器中应用的理论与实践Kalman
MATLAB在卡尔曼滤波器中应用的理论与实践KalmanKALMAN FILTERINGTheory and Practice Using MATLABThird editionMOHINDER S GREWALCalifornia State University at FullertonANGUS P. ANDREWSRockwell Science Center (retired)WILEYA JOHN WILEY & SONS, INC. PUBLICATIONCopyright 2008 by John Wiley sons, Inc. All rights reservedPublished by John Wiley sons, InC, Hoboken, New JerseyPublished simultaneously in CanadaNo part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or byany means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permittedunder Section 107 or 108 of the 1976 United States Copyright Act, without either the prior writtenpermission of the Publisher, or authorization through payment of the appropriate per-copy fee to theCopyright Clearance Center, Inc, 222 Rosewood Drive, Danvers, MA 01923,(978)750-8400, fax(978)750-4470,oronthewebatwww.copyright.com.RequeststothePublisherforpermissionshouldbe addressed to the Permissions Department, John Wiley Sons, Inc, lll River Street, Hoboken, NJ07030,(201)748-6011,fax(201)748-6008,oronlineathttp://www.wiley.com/go/permissionimit of liability Disclaimer of Warranty: While the publisher and author have used their best efforts inpreparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability orfitness for a particular purpose. No warranty may be created or extended by sales representatives orwritten sales materials. The advice and strategies contained herein may not be suitable for your situationYou should consult with a professional where appropriate. Neither the publisher nor author shall be liablefor any loss of profit or any other commercial damages, including but not limited to special, incidentalconsequential, or other damagesFor general information on our other products and services or for technical support, please contact ourCustomer Care Department within the United States at(800)762-2974, outside the United States at(317)572-3993 or fax(317)572-4002Wiley also publishes its books in a variety of electronic formats. Some content that appears in print maynot be available in electronic format. For more information about wiley products, visit our web site atwww.wiley.comLibrary of Congress Cataloging- in-Publication DataGrewal. Mohinder sKalman filtering: theory and practice using MATLAB/Mohinder S. GrewalAngus p. andrews. 3rd edIncludes bibliographical references and indexISBN978-0-470-17366-4( cloth)1. Kalman filtering. 2. MATLAB. I. Andrews, Angus P. II. TitleQA402.3.G69520086298312—dc22200803733Printed in the United States of america10987654321CONTENTSPrefaceAcknowledgmentsXIIIList of abbreviationsXV1 General Information1.1 On Kalman Filtering1.2 On Optimal Estimation Methods, 51. 3 On the notation Used In This book 231. 4 Summary, 25Problems. 262 Linear Dvnamic Systems2. 1 Chapter focus, 312.2 Dynamic System Models, 362. 3 Continuous Linear Systems and Their Solutions, 402.4 Discrete Linear Systems and Their Solutions, 532.5 Observability of Linear Dynamic System Models, 552.6 Summary, 61Problems. 643 Random Processes and Stochastic Systems3.1 Chapter Focus, 673.2 Probability and random Variables (rvs), 703.3 Statistical Properties of RVS, 78CONTEN3.4 Statistical Properties of Random Processes(RPs),803.5 Linear rp models. 883.6 Shaping Filters and State Augmentation, 953.7 Mean and Covariance propagation, 993.8 Relationships between Model Parameters, 1053.9 Orthogonality principle 1143.10 Summary, 118Problems. 1214 Linear Optimal Filters and Predictors1314.1 Chapter Focus, 1314.2 Kalman Filter. 1334.3 Kalman-Bucy filter, 1444.4 Optimal Linear Predictors, 1464.5 Correlated noise Sources 1474.6 Relationships between Kalman-Bucy and wiener Filters, 1484.7 Quadratic Loss Functions, 1494.8 Matrix Riccati Differential Equation. 1514.9 Matrix Riccati Equation In Discrete Time, 1654.10 Model equations for Transformed State Variables, 1704.11 Application of Kalman Filters, 1724.12 Summary, 177Problems. 1795 Optimal Smoothers5.1 Chapter Focus, 1835.2 Fixed-Interval Smoothing, 1895.3 Fixed-Lag Smoothing, 2005.4 Fixed-Point Smoothing, 2135.5 Summary, 220Problems. 226 Implementation Methods2256. 1 Chapter Focus, 2256.2 Computer Roundoff, 2276.3 Effects of roundoff errors on Kalman filters 2326.4 Factorization Methods for Square-Root Filtering, 2386. 5 Square-Root and UD Filters, 2616.6 Other Implementation Methods, 2756.7 Summary, 288Problems. 2897 Nonlinear Filtering2937.1 Chapter Focus, 2937.2 Quasilinear Filtering, 296CONTENTS7.3 Sampling Methods for Nonlinear Filtering, 3307.4 Summary, 345Problems. 3508 Practical Considerations3558.1 Chapter Focus. 3558.2 Detecting and Correcting Anomalous behavior, 3568.3 Prefiltering and Data Rejection Methods, 3798.4 Stability of Kalman Filters, 3828. 5 Suboptimal and reduced- Order Filters, 3838.6 Schmidt-Kalman Filtering, 3938.7 Memory, Throughput, and wordlength Requirements, 4038.8 Ways to Reduce Computational requirements 4098.9 Error Budgets and Sensitivity Analysis, 4148.10 Optimizing Measurement Selection Policies, 4198.11 Innovations analysis, 4248.12 Summary, 425Problems. 4269 Applications to Navigation4279.1 Chapter focus, 4279.2 Host vehicle dynamics, 4319.3 Inertial Navigation Systems(INS), 4359. 4 Global Navigation Satellite Systems(GNSS), 4659.5 Kalman Filters for GNSS. 4709.6 Loosely Coupled GNSS/INS Integration, 4889.7 Tightly Coupled GNSS /INS Integration, 4919. 8 Summary, 507Problems. 508Appendix A MATLAB Software511A 1 Notice. 511A 2 General System Requirements, 511A 3 CD Directory Structure, 512A 4 MATLAB Software for Chapter 2, 512A. 5 MATLAB Software for Chapter 3, 512A6 MATLAB Software for Chapter 4, 512A. 7 MATLAB Software for Chapter 5, 513A 8 MATLAB Software for Chapter 6, 513A 9 MATLAB Software for Chapter 7, 514A10 MATLAB Software for Chapter 8, 515A 11 MATLAB Software for Chapter 9, 515A 12 Other Sources of software 516CONTENAppendix b A Matrix Refresher519B. 1 Matrix Forms. 519B 2 Matrix Operations, 523B 3 Block matrix Formulas. 527B 4 Functions of Square Matrices, 531B 5 Norms. 538B6 Cholesky decomposition, 541B7 Orthogonal Decompositions of Matrices, 543B 8 Quadratic Forms, 545B 9 Derivatives of matrices. 546Bibliography549Index565PREFACEThis book is designed to provide familiarity with both the theoretical and practicalaspects of Kalman filtering by including real-world problems in practice as illustrativeexamples. The material includes the essential technical background for Kalman filter-ing and the more practical aspects of implementation: how to represent the problem ina mathematical model, analyze the performance of the estimator as a function ofsystem design parameters, implement the mechanization equations in numericallystable algorithms, assess its computational requirements, test the validity of resultsitor the filteThetant attributes ofthe subject that are often overlooked in theoretical treatments but are necessary forapplication of the theory to real-world problemsIn this third edition, we have included important developments in the implemen-tation and application of Kalman filtering over the past several years, including adaptations for nonlinear filtering, more robust smoothing methods, and develelopingapplications in navigationWe have also incorporated many helpful corrections and suggefrom ourreaders, reviewers, colleagues, and students over the past several years for theoverall improvement of the textbookAll software has been provided in MatLab so that users can take advantage ofits excellent graphing capabilities and a programming interface that is very close tothe mathematical equations used for defining Kalman filtering and its applicationsSee Appendix a for more information on MATLAB softwareThe inclusion of the software is practically a matter of necessity because Kalmanfiltering would not be very useful without computers to implement it. It provides aMATLAB is a registered trademark of The Mathworks, IncEFACEbetter learning experience for the student to discover how the Kalman filter works byobserving it in actionThe implementation of Kalman filtering on computers also illuminates some of thepractical considerations of finite-wordlength arithmetic and the need for alternativealgorithms to preserve the accuracy of the results. If the student wishes to applywhat she or he learns, then it is essential that she or he experience its workingsand failings--and learn to recognize the differenceThe book is organized as a text for an introductory course in stochastic processes atthe senior level and as a first-year graduate-level course in Kalman filtering theory andapplicationIt can also be used for self-instruction or for purposes of review by practi-cing engineers and scientists who are not intimately familiar with the subject. Theorganization of the material is illustrated by the following chapter-level dependencygraph, which shows how the subject of each chapter depends upon material in otherchapters. The arrows in the figure indicate the recommended order of study. Boxesabove another box and connected by arrows indicate that the material represented bythe upper boxes is background material for the subject in the lower boxAPPENDIX B: A MATRIX REFRESHERGENERAL INFORMATION2. LINEAR DYNAMIC SYSTEMSRANDOM PROCESSES AND STOCHASTIC SYSTEMS4. OPTIMAL LINEAR FILTERS AND PREDICTORS5. OPTIMAL SMOOTHERS6. IMPLEMENTATIONMETHODS7. NONLINEAR8. PRACTICAL9. APPLICATIONSFILTERINGCONSIDERATIONSTO NAVIGATIONAPPENDIX A: MATLAB SOFTWAREChapter l provides an informal introduction to the general subject matter by wayof its history of development and application. Chapters 2 and 3 and Appendix b coverthe essential background material on linear systems, probability, stochastic processesand modeling. These chapters could be covered in a senior-level course in electricalcomputer, and systems engineeringChapter 4 covers linear optimal filters and predictors, with detailed examples ofapplications. Chapter 5 is a new tutorial-level treatment of optimal smoothing
- 2020-12-01下载
- 积分:1