Glad it works. What do you mean by "a pick selects all cells with same ID" ? Is ID a cell array? If so, you can already do so using the Edit | "Find Data" dialog [ http://www.paraview.org/Wiki/Find_Data_using_Queries ]
Utkarsh On Wed, Apr 21, 2010 at 5:10 PM, Christian Werner <christian.wer...@rwth-aachen.de> wrote: > This works perfectly, thank you very much! The processing is getting really > professional now. > > As for the selection tools, should I just go ahead and write a feature > request? (a pick selects all cells with same ID / enable multiselect so you > do not have to use the Ctrl-Key anymore) > > Best regards, > Christian > > > > Utkarsh Ayachit wrote: >> >> Christian, >> >> Attached is simple python script (that you can encapsulate as a macro) >> to which you can add code to processes the extract points however you >> like. I am simply writing them out to a file. >> >> To use this script, do the following (to keep it simple I am using the >> Sphere source as an example, no reason why it won't work with your >> data). >> 1> Create Sphere source >> 2> Create a selection of points or cells >> 3> Open Python Shell and run the attached script. >> >> As as result, you'll have a mygrid.vtu file written out with the >> extracted points(or cells). No 3 seconds waits, no errors writing >> files, no need for the user to create extract selection filter. >> >> Using the python macros capability, you can make this script a >> trigger-able from a toolbutton. >> >> Utkarsh >> >> On Wed, Apr 21, 2010 at 8:55 AM, Christian Werner >> <christian.wer...@rwth-aachen.de> wrote: >> >>> >>> Hi! >>> >>> I made a new topic about that selection thing. Here is my use-case: >>> >>> Overview: We have volumetric data of metal components. These components >>> contain unwanted defects (holes that appear during the casting process). >>> These holes are visible as dark regions (objects) in the data. >>> Unfortunately, there are other structures in the metal that are also dark >>> (graphite). After a few image processing steps many of those objects >>> (defects and graphite) are segmented out of the originial volume data. A >>> contouring (and connectivity filtering) yields a nice visualization of >>> those >>> objects. >>> >>> Use Case: Select defects >>> Goal: The user selects the defects out of the many presented objects. >>> >>> Details: Due to the extremely cool features of Paraview, the user is able >>> to >>> mix the views of all extracted objects and the original volume data (see >>> image) to easily verify which object is a defect and which one is >>> graphite. >>> When the user identifies an object as a defect, he marks it by a simple >>> click. The object will highlight so the user can always see which objects >>> have already been selected. When the user is done selecting all defects, >>> he >>> clicks on the "Measure Defects" button. A database containing all >>> necessary >>> information on the defects (centroid, total volume, volume >>> percentage,...) >>> will automatically be created and saved in a secret place. >>> >>> Remark: >>> The "Measure Defects Button" will call a Python macro that desperately >>> tries >>> to extract the selected objects (points). These points are needed for >>> correspondance to the original volume data that is actually being >>> analyzed >>> (the mean grey value of a defect and such are important quantities). >>> Certainly, one single point per object suffices for this correspondance. >>> >>> >>> Best regards, >>> Christian >>> >>> >>> Utkarsh Ayachit schrieb: >>> >>>> >>>> Christian, >>>> >>>> O-oh! We can't have our users going mad now can we :). Guess we are >>>> looking at this the wrong way, instead of working from the solution, >>>> let's start with the problem/use-case. Can you describe your use-case >>>> as simply as possibly. What's the goal here? What is the user doing? >>>> >>>> Utkarsh >>>> >>>> On Mon, Apr 19, 2010 at 11:20 AM, Christian Werner >>>> <christian.wer...@rwth-aachen.de> wrote: >>>> >>>> >>>>> >>>>> Does that mean that I have to create a selection with explicitly >>>>> defining >>>>> the points? Oh man... Then I can forget the whole thing anyway. >>>>> >>>>> Everything is so nice about Paraview, but this selection thing is >>>>> driving >>>>> me >>>>> mad. >>>>> >>>>> It's still all about making it as easy as possible for the user to >>>>> select >>>>> objects out of Polydata and let a plugin analyze these objects. As it >>>>> seems >>>>> now, the user has to: >>>>> >>>>> 1) Ctrl+Click matching objects one after another (already dangerours, >>>>> because you might forget to hold down Ctrl when selecting) >>>>> 2) go to Filter->Recent->ExtractSelection >>>>> 3) wait at least 3 seconds >>>>> 4) call a plugin that writes the extracted points' coordinates and >>>>> their >>>>> ID >>>>> to a file >>>>> 5) call the analyzing plugin that reads out the file (to get the >>>>> RegionID >>>>> and coordinates) and does the analysing stuff (in ITK) >>>>> >>>>> I have found a way to do that "wait 3 seconds" in Python using a >>>>> thread(!) >>>>> which checks the time and joins after some seconds. Using sleep(5) >>>>> simply >>>>> froze everything and postponed the segmentation fault (which clearly >>>>> comes >>>>> from my writer that doesn't have input). Another possibility would be >>>>> to >>>>> modify vtkExtractSelection to suite my needs, but I won't do that, >>>>> since >>>>> I >>>>> don't have time for that anymore. This workaround has to do. >>>>> >>>>> Anyway, Paraview, VTK and ITK are really nice, I am glad I found these >>>>> open-source tools. >>>>> >>>>> Best regards, >>>>> Christian >>>>> >>>>> >>>>> >>>>> Utkarsh Ayachit schrieb: >>>>> >>>>> >>>>>> >>>>>> Does your data have time? If not, you don't need to specify the >>>>>> time=10000 attribute at all. So SelectionWriter is the thing that's >>>>>> coming from your plugin? Does it support writing empty datasets? Can >>>>>> you attach a debugger and see where is crashes? Are you sure it's not >>>>>> crashing in the writer? I dont' see why UpdatePipeline() on extract >>>>>> selection would crash. Instead of using a macro, try manually typing >>>>>> the text in the python shell to see exactly what line causes the >>>>>> segfault. >>>>>> >>>>>> BTW, ExtractSelection needs two inputs: 'Input" and "Selection" where >>>>>> Selection is set to the SelectionQuerySource proxy. >>>>>> >>>>>> Utkarsh >>>>>> >>>>>> On Mon, Apr 19, 2010 at 10:34 AM, Christian Werner >>>>>> <christian.wer...@rwth-aachen.de> wrote: >>>>>> >>>>>> >>>>>> >>>>>>> >>>>>>> I am afraid UpdatePipeline doesn't help, even if I set the time to >>>>>>> some >>>>>>> high >>>>>>> value. Paraview crashes right in the moment where I start this macro: >>>>>>> >>>>>>> extract=ExtractSelection(Input=ConnectivityFilter) >>>>>>> >>>>>>> UpdatePipeline(time= 10000, proxy=extract) >>>>>>> >>>>>>> mFilename = destPath + str( time() ) >>>>>>> >>>>>>> swriter=SelectionWriter(Input=extract) >>>>>>> >>>>>>> swriter.FileName=mFilename >>>>>>> >>>>>>> swriter.UpdatePipeline() >>>>>>> >>>>>>> >>>>>>> When I manually select Fiters->ExtractSelection and then do: >>>>>>> >>>>>>> mFilename = destPath + str( time() ) >>>>>>> >>>>>>> swriter=SelectionWriter() >>>>>>> >>>>>>> swriter.FileName=mFilename >>>>>>> >>>>>>> swriter.UpdatePipeline() >>>>>>> >>>>>>> >>>>>>> everything works fine. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Utkarsh Ayachit schrieb: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> You can simply call UpdatePipeline() as follows: >>>>>>>> >>>>>>>> from paraview.simple import * >>>>>>>> .... >>>>>>>> UpdatePipeline(proxy=extractSelectionSource) >>>>>>>> >>>>>>>> This will update the extract selection filter explicitly. Look at >>>>>>>> help(UpdatePipeline) for details. >>>>>>>> >>>>>>>> Utkarsh >>>>>>>> >>>>>>>> >>>>>>>> On Sun, Apr 18, 2010 at 3:38 PM, Christian Werner >>>>>>>> <christian.wer...@rwth-aachen.de> wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> >>>>>>>>> Hi Utkarsh, >>>>>>>>> >>>>>>>>> these are great news. I tried the python trace but not in >>>>>>>>> combination >>>>>>>>> with >>>>>>>>> the extraction (what I acutally do need anyway....) >>>>>>>>> >>>>>>>>> As you might remember I am working around the "lack" of possibilty >>>>>>>>> to >>>>>>>>> select >>>>>>>>> whole objects (cells with same RegionID). With the given >>>>>>>>> SelectionQuerySource this workaround is complete. >>>>>>>>> >>>>>>>>> There remains one issue: At some point I call an ExtractSelection() >>>>>>>>> in >>>>>>>>> Python that is followed by a call to a vtk-Plugin (which writes the >>>>>>>>> point >>>>>>>>> data of the selected points to disk). The resulting file is empty, >>>>>>>>> because >>>>>>>>> the Extraction takes a few seconds and obviously the plugin has no >>>>>>>>> valid >>>>>>>>> input when being executed. Paraview also crashes as a consequence. >>>>>>>>> When >>>>>>>>> I >>>>>>>>> am >>>>>>>>> doing this manually (trigger ExtractSelection, wait until it's >>>>>>>>> done, >>>>>>>>> call >>>>>>>>> the vtk Plugin to write the point data) everything works fine. I >>>>>>>>> could >>>>>>>>> just >>>>>>>>> go ahead and do a dull time.sleep(3) between the extraction and the >>>>>>>>> call >>>>>>>>> to >>>>>>>>> the plugin, but this certainly isn't good programming style. >>>>>>>>> >>>>>>>>> What can I do instead? >>>>>>>>> >>>>>>>>> >>>>>>>>> Best regards, >>>>>>>>> Christian >>>>>>>>> >>>>>>>>> >>>>>>>>> Utkarsh Ayachit wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>> Yes, you can use the "SelectionQuerySource" to construct your >>>>>>>>>> query >>>>>>>>>> as >>>>>>>>>> follows: >>>>>>>>>> >>>>>>>>>> selection_source_540 = SelectionQuerySource( InsideOut=0, >>>>>>>>>> ArrayName='', HierarchicalLevel=-1, ProcessID=-1, >>>>>>>>>> ContainingCells=0, >>>>>>>>>> DoubleValues=None, HierarchicalIndex=-1, FieldType='CELL', >>>>>>>>>> ArrayComponent=0, Operator='IS_ONE_OF', TermMode='ID', >>>>>>>>>> CompositeIndex=-1, IdTypeValues=0 ) >>>>>>>>>> >>>>>>>>>> You can use the python trace recorder functionality to determine >>>>>>>>>> how >>>>>>>>>> to create the query. You will, however have to "Extract Selection" >>>>>>>>>> from the query (and hit apply) before the selection_source object >>>>>>>>>> will >>>>>>>>>> appear in the trace. >>>>>>>>>> >>>>>>>>>> Utkarsh >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Sat, Apr 17, 2010 at 9:32 AM, Christian Werner >>>>>>>>>> <christian.wer...@rwth-aachen.de> wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Hello! >>>>>>>>>>> >>>>>>>>>>> Is there any chance that the new Edit->Find Data functionality is >>>>>>>>>>> available >>>>>>>>>>> in Python-Scripting? >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Best regards, >>>>>>>>>>> Christian >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Powered by www.kitware.com >>>>>>>>>>> >>>>>>>>>>> Visit other Kitware open-source projects at >>>>>>>>>>> http://www.kitware.com/opensource/opensource.html >>>>>>>>>>> >>>>>>>>>>> Please keep messages on-topic and check the ParaView Wiki at: >>>>>>>>>>> http://paraview.org/Wiki/ParaView >>>>>>>>>>> >>>>>>>>>>> Follow this link to subscribe/unsubscribe: >>>>>>>>>>> http://www.paraview.org/mailman/listinfo/paraview >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>>> >>>>> >>>>> _______________________________________________ >>>>> Powered by www.kitware.com >>>>> >>>>> Visit other Kitware open-source projects at >>>>> http://www.kitware.com/opensource/opensource.html >>>>> >>>>> Please keep messages on-topic and check the ParaView Wiki at: >>>>> http://paraview.org/Wiki/ParaView >>>>> >>>>> Follow this link to subscribe/unsubscribe: >>>>> http://www.paraview.org/mailman/listinfo/paraview >>>>> >>>>> >>>>> >>> >>> > > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview