基于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
ansoft Maxwell 3d教程.pdf
ansoft Maxwell 3d 向导式的用户界面、精度驱动的自适应剖分技术和强大的后处理器时的Maxwell 3D成为业界最佳的高性能三维电磁设计软件。可以分析涡流、位移电流、集肤效应和邻近效应具有不可忽视作用的系统,得到电机、母线、变压器、线圈等电磁部件的整体特性。功率损耗、线圈损耗、某一频率下的阻抗(R和L)、力、转矩、电感、储能等参数可以自动计算。同时也可以给出整个相位的磁力线、B和H分布图、能量密度、温度分布等图形结果。本文件是软件使用教程.希望能帮助大家·Printing HistorNew editions of this manual include material up dated since theprevious edition. The manual printing date, indicating the manualscurrent edition, changes w hen a ncw edition is printed. Minorcorrections and updates incorporated al reprint do not cause the daleto changeUpdate packages may be issued betw een editions and containadditional and/ or rep lacement pages to be merged into the manualby the user Pages which are rearranged because of changes on aprevious page are not considered to be revised.EditionDateSoftwareRevisionFebruary 1991April 199212December 1993October 19964.1September 19995.06December 20006.0WWW⊥nmTypeface ConventionsComputerCter type is used fon promptsand messages, for field names, and for keyboard entries that must be ty ped in theirentirety exactly as shown. For example, thenstruction"copy filel"means to type the w ordcopy, to type a space. and then to type filelMenu/Command Computer type is also used to display the commands that are needed to perform a specifictask Menu levels are separated by forwardslashes (/) For example, the instructionhoose File/Open"means to choose the Opencommand under the file menuItalicsItalic type is used for emphasis and for thetitles of manuals and other publications. Italictype is also used for key board entries when aname or a variable must be typed in place ofthe words in italics. For example, the instruc-rion“ copy filename” means to type the wordcopy, to type a space, and then to type then amc of a filc. such as filelKeysHelvetica type is used for labeled keys on thecomputer keyboard. For example, the instruc-tion"Press Return?"means to press the key onthe com puter that is lahcled Returnwww.docin.coInstallationBefore you use Maxwell 3D, you must1. Set up your systems graphical windowing systerm2. Install the Maxwell softw are, using the directions in theAnsell PC or UNIX Installation guideIf you have not yet done these steps, refer to the ansoft installetionguides and the documentation that came w ith your computer systemor ask your system administrator for helpsing a Graphical User InterfaceIf you are familiar with the concepts of using a mouse, menus, andother graphical user interface(GUn)tools, skip to Chapter 1“ IntroductionIf you have not used GuI systems before, this section will help youunderstand some of the terminology used in this guide. Since GUIare basically visual, the best way to learn to use them is by practicingon your systemMost gui systcms usc a mouseas a poinTing device, with whichyou can select areas on the screenfor command execution andmoving from one program toanother. Your mouse may have 2www.door 3 buttons; Maxwell 3D ignoresthe middle button on 3-buttondelsAnsoft products donot usc this button. You canprogram mouse buttons to work in non-standard ways, as you mightwant to if you are left-handed. For simplicity, the left-hand hutton(under your forefinger if you are right-handed) is called the leftbutton, and the one on far right is the right mouse button. You willprobably find the terms intuitive once you use these buttons a fewtimesPoint and click; Right clickTo choose an item with the mouse, first move it on your desk until thearrow cursor is on that item; you are now pointing" at the item. Next,ress and release the left bu tton thlled"clicking " Point-andclick is the most common action you will make with your mouseally, click" refers to a lefise button clickYou can sometimes use your right mouse button to access or entercommands. In the 3d Modeler for instance, a right mouse buttonclick causes a short menu of commands to appear at the moustcursor. Generally, right click "refers to a right mouse button clickDouble-ClickOccasionally you may want to sclect all of thc text in a box,orperform a special lask(such as indicating the end of drawing a linewhile you are using Maxwell 3D. You can do this efficiently byquickly clicking twice with your left mouse button -a doubleDragging objects; Click and HoldWhen you are drawing in the 3D Modeler, you can often use yourmouse to enter objects and move around the screen. Frequently, youwill click the mouse button and hold it down until the next part of thecommand is reached (the object is oved, the next point is enteredand so forth). If you click and hold on the edge of a w indow, you canposition, or drag, the window on your screen. You can often dragobjects in Maxwell; experiment to see w hat will moveTool BarsTool bars are shortcut methods for entering commands. There is atool bar in the 3d Modeler and most of the setup modules for severalcommand s. To use a tool bar. click the mouse cursor on the buttonyou want to use. Here is an example of a tool bar囗。圖哦良风≌固函MenusWithin each screen of maxwell 3d are areas w hich list subsets ormenus,of commands. You can access a menu by clicking your mouseon the word or button that indicates the menu. The menu is pulleddown, listing the commands available on that menu. (For examplethc New command is availablc on the File mcnu. Usually, thc mcnuwill remain displayed until you choose a command, or click on thedesktop to exit. If the menu does not remain displayed, click and holdthe mouse button, then release the button to make your choiceFile Edit viewNewopenCloseSavectrl+SSave AsImportExportExitctrl+QAn arrow on the right side of a command indicates that there is asubmenu for that command. An ellipsis (. )indicates that a pop-upwindow appears aftcr choosing this commandWhen you are asked to use a menu command, each level is separatedby a"/". Thus, to zoom in on a drawing, you would choose the viewLoom In menu command To open a new file, you would choose File/There are also pop-up menus, which appear when you righL-click ona maxwell modeler window. choose commands from thcsc menus inthe same way as from menu barsFor more information on using GUIs, refer to"User Interface"in theMaxwell Control Panel,s online help systemOther ReferencesFor detailed information on Maxwell 3d commands refer to theonline documentation for the maxwell 3d field simulatorTo start maxwell 3d, you must first access the maxwell controlPanel. for more detailed inform ation on the maxwell control panelcommands, refer to the Maxwell Control Panels online help systemwww.docin.comTable of Contents1. Introduction1-1General Procedure.1-2The Sample Problem1-4Meshes.....,,,,,,,,面2. Create aAccess the maxwell Control Panel·:.·:·甲,,,,,,,,,,2-2Start the Project managerCreate a Project directoryCreate a New project··,···············,·,,,,,,,,,,2-6Enter notes2-73. Draw the model3-1Open the project3-2Start. the 3D Modeler3-3Side window........................snaps3-6Define the problem region: Coordinates and Units ..,...... 3-7Absolute and relative coordinates3-7Grids3-7Zooming in and out of the view window3-9Create the electromagnet3-10Draw the Coil...,,.,..,3-10Draw thc Circlc........,..,...,,,......,..........3-10Create the Cylinder,,3-11Create the hole for the Core3-12Draw the Core·中··············3-13SavingP3-14Create the magnel翻...3-15Draw the magnet3-15Move the magnet3-15Toggle Off the Background..................3-16Create a termini..........,,,,,..,,,,......,,,..3-17Create the Coil terminal..........,,......,,,.,..3-18Define the Problem Region;..,;;“;##.3-20Define the Problem Region .................. 3-21Shading and rendering . ......................................3-22Exit the 3d modeler3-234 Define The problemAccess the Material Manager4-2Exclude the background·····+···,,,,,,,,,,,,,,.4-2Assign Steel to the CoreAssign Copper to the Coil4-3Assign vacuum to the problem Region.......4.......4-3Assign NdFe35 to the Magnet4-3Access the 3D Boundary/Source Manager45assign a current to the coil.....4-6Define the sourceAssigning the Source lo the Termina.........,..,,,,∴4-64-7Check the Direction of the CurrentExit the 3D Boundary/Source Manager4-85. Generate a Solution5-1Setup executive Parameters······5-2Create a Force Setup for the Magnet.5-3Create a Force Setup for the Coil and Core5-3Create a Force Setup for the entire model·········Exiting the Executive Parameters moduleSpecifying Solution Criteria·非5-5Solver type11翻自。■非非首·····:.··.·Magnetic Field SolveResidualSolve for Field and Parameters+++++++++++++++++++++;,+“++Adaptive analysisContents-2
- 2020-11-27下载
- 积分:1