[vtkusers] Want vtk dataset from my DICOM data
Eric E. Monson
emonson at cs.duke.edu
Thu May 21 10:55:20 EDT 2009
Hey Chris,
If the other plate is touching the data you need, you'll have to
figure out another way of getting rid of that data -- the connectivity
filter will see all of these touching regions as one. Do they
disconnect from each other if you change slightly the value in your
contour filter? If not, you'll probably have to do something like
define a selection based on the physical position of the objects and
extract the surface you want from the combined head/plate surface.
This sort of thing is often easier in an interactive visualization, so
you might want to use ParaView (or Amira, or something else) to figure
this out or do some pre-processing on your data.
Update() forces the pipeline to execute, which generates the real data
up to that point in the pipeline. From page 24 of The VTK User's Guide
(v5, 2006):
"Normally, you do not need to manually invoke Update() because the
filters are connected into a visualization pipeline. In this case,
when the actor receives a request to render itself, it forwards the
method to its mapper, and the Update() method is automatically sent
through the visualization pipeline."
As you saw, you sometimes need to call this manually when you're
trying to get intermediate data out, so the pipeline must be executed
before it necessarily gets to the stage where the actors would call
Update() themselves.
Modified() "updates the the internal modification time stamp for the
object" (pg 181, ibid), which will tell the pipeline that this filter
needs to be updated the next time the pipeline is executed.
Talk to you later,
-Eric
On May 21, 2009, at 5:31 AM, Chris N wrote:
> Thanks for the help, I feel I am getting close to my answer but not
> quite there yet. Sorry about not "replying to all" but will do that
> from now. Just a quick recap trying to remove two plates & internal
> canal of ears & throat from human head.
>
> Using vtkPolyDataConnectivityFilter did give me some results now
> which is great. When I used connectivity filter I had the exact
> same contour. Now tried to use your suggestions with the color
> region but nothing ever came up for me. Also I was still seeing
> GetNumberOfExtractedRegions() print out a '0'. Looking through my
> functions I found Update() and when I use this I now get from
> GetNumberOfExtractedRegions() 349. By that point I tried
> SetExtractionModeToLargestRegion() and removed one of the plates not
> touching the data head. Inside the head removed everything that was
> not connected which is good. I attempted the color regions as you
> told me but since got no results for coloring regions. So now I
> need to come up with a solution to remove the other plate though it
> is touching data I need. Of course, I need think of a way to remove
> the canals from ears & throat also. Any suggestions, is
> vtkPolyDataConnectivityFilter still capable for something like that?
>
> Since I'm using vtkPolyDataConnectivityFilter::Update() & saw
> vtkPolyDataConnectivityFilter::Modifed(), do you know what exactly
> do these functions do?
>
> -Chris
> CC: vtkusers at vtk.org
> From: emonson at cs.duke.edu
> To: alucard006 at msn.com
> Subject: Re: [vtkusers] Want vtk dataset from my DICOM data
> Date: Wed, 20 May 2009 09:22:58 -0400
>
> Hey Chris,
>
> Make sure you "reply to all" so that the whole list can contribute
> answers.
>
> First, this probably isn't causing any of your problems, but you may
> want to switch to the vtkPolyDataConnectivityFilter -- since the
> contour filter will output polygonal mesh, this filter may be
> optimized a bit more for that specific data type.
>
> Second, what shows up in your vtkRenderWindow? Do you see the whole
> contour as if you didn't even use the connectivity filter?
>
> Try setting the connectivity filter to
> connect->SetExtractionModeToAllRegions();
> connect->SetColorRegions(1);
>
> and see if you see a lot of differently colored regions. Or, try
>
> connect->SetExtractionModeToSpecifiedRegions();
> connect->AddSpecifiedRegion(0);
> connect->AddSpecifiedRegion(1);
> connect->SetColorRegions(1);
>
> and look in the render window to see if the correct subsets are
> being extracted.
>
> I'm sure there are a lot of people out there using this filter, so I
> hope someone else will chime in that knows more than me about this
> specific one! :)
>
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
>
> On May 20, 2009, at 3:59 AM, Chris N wrote:
>
> This is my specific problem currently. I working with DICOM data
> using VTK and C++. My DICOM data is a human head and I'm trying to
> make my data only view skin. The problem I running into now is that
> I want to eliminate the internals such as the canals for ears and
> throat when I only render skin. Along with the depth I have two
> plates rendered on the side of my sample head data.
>
> Recently I found vtkConnectivityFilter has the function to extract
> the largest region and ignoring everything else. When I try to use
> this class and I view the number of connected regions extracted I
> only get the number 0. My data still remains the same and unaltered
> as though I never used connectivityfilter. Below I just added the
> only code I wrote for the vtkConnectivityFilter, maybe I missed
> something there? Any suggestions?
>
> //vtkDICOMImageReader - using set directory name
>
> //vtkContourFilter - (skinExtractor) set value for skin
>
> //CONNECTIVITY
> vtkConnectivityFilter *connect = vtkConnectivityFilter::New();
> connect->SetInputConnection(skinExtractor->GetOutputPort());
> connect->SetExtractionModeToLargestRegion();
> //NUMBER OF REGIONS
> int numregion = connect->GetNumberOfExtractedRegions();
> std::cout<< "Number of Connected Regions: " << numregion <<endl;
>
> //Window, Outline, Actor, etc.
>
>
>
> From: emonson at cs.duke.edu
> To: alucard006 at msn.com
> Date: Tue, 19 May 2009 12:37:58 -0400
> CC: vtkusers at vtk.org
> Subject: Re: [vtkusers] Want vtk dataset from my DICOM data
>
> Hey Chris,
>
> The output from the vtkDICOMImageReader is an instance of
> vtkImageData, so as the pipeline continues that is what is
> processed. In python, you can get this data by calling
> reader.GetOutput() or reader.GetOutputDataObject(0), and similar in C
> ++.
>
> If you really want to save that data in another file, one option
> would be to use the vtkXMLImageDataWriter to write to a .vti file.
> Otherwise, just use the reader and feed its output port into the
> input port of the Contour filter as you've seen recently.
>
> If this isn't clear, just let us know more specifically what
> problems you're having.
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On May 19, 2009, at 4:44 AM, Chris N wrote:
>
> NEW USER but I've been reading similiar problems with using
> vtkPolyDataConnectivityFilter with DICOM data. One person did post
> a solution but using the standard vtk dataset from vtkdata. Is it
> possible to convert my DICOM data into vtk data set so once that is
> done I can use my vtkPolyDataConnectivityFilter on that data set.
> Or does DICOMreader do convert into vtk dataset already? If that is
> the case how can I retieve that data? Ultimately, I'm trying to
> filter out data with vtkPolyDataConnectivityFilter and using my
> DICOM data. any help is appreciated, thanks!
>
>
> Hotmail® has a new way to see what's up with your friends. Check it
> out. _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> Windows Live™: Keep your life in sync. Check it out.
>
>
> Hotmail® goes with you. Get it on your BlackBerry or iPhone.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/8a0bb92b/attachment.htm>
More information about the vtkusers
mailing list