Hi Luca,

I managed to compile the latest source from the github repo on Windows 7
64-bit. However, I was getting the following error in
vmtkLevelSetSegmentation.py on line 314:

        "AttributeError: 'module' object has no attribute
'vmtkImageInitialization'"

For whatever reason, "import vmtkscripts" at line 22 wasn't pulling in
vmtkImageInitialization. I verified this by dumping the object's properties
right before line 314:

        import vmtkimageinitialization
        l = dir(vmtkscripts)
        self.PrintLog('\n'.join(l))

The only module missing is vmtkImageInitialization.

I got around this by replacing line 314:

        self.vmtkImageInitialization = vmtkscripts.vmtkImageInitialization()

with this:

        import vmtkimageinitialization
        self.vmtkImageInitialization =
vmtkimageinitialization.vmtkImageInitialization()

I then call the script as follows:

        vmtkimagereader  -f dicom  -d C:/DICOM/ --pipe
 vmtkimageinitialization -interactive 0 -method collidingfronts
-sourcepoints 210  214  208 196  196  200 -targetpoints 204  204  204 188
 190  193  --pipe vmtklevelsetsegmentation -iterations 100  -advection 1.0
 -curvature 0.1  -propagation 0.0  --pipe vmtkimageviewer -i @.LevelSets

I currently have two questions:

1) vmtkLevelSetSegmentation does not seem to have a non-interactive mode,
as the above call brings up the VTK window and asks for the level set
segmentation parameters. This is also apparent in the source code. Luca, do
you have an uncommitted version of this file that supports non-interactive
mode?

2) The pipe to vmtkImageViewer at the end of the command does not display
the segmentation, but the DICOM volume. How can I pipe the segmentation
instead?

Thanks,
Richard




On Wed, Jun 26, 2013 at 5:53 PM, Richard Abrich <abri...@gmail.com> wrote:

> Answering my own question again:
>
> It turns out that the Colliding Fronts initialization code didn't support
> multiple start and end points. Lines 295-296:
>
>
> seedIds1.InsertNextId(self.Image.ComputePointId([self.SourcePoints[0],self.SourcePoints[1],self.SourcePoints[2]]))
>
> seedIds2.InsertNextId(self.Image.ComputePointId([self.TargetPoints[0],self.TargetPoints[1],self.TargetPoints[2]]))
>
> Need to be replaced with:
>
>             for i in range(len(self.SourcePoints)/3):
>
> seedIds1.InsertNextId(self.Image.ComputePointId([self.SourcePoints[3*i+0],self.SourcePoints[3*i+1],self.SourcePoints[3*i+2]]))
>
>             for i in range(len(self.TargetPoints)/3):
>
> seedIds2.InsertNextId(self.Image.ComputePointId([self.TargetPoints[3*i+0],self.TargetPoints[3*i+1],self.TargetPoints[3*i+2]]))
>
>
> Now it works.
>
>
>
> On Wed, Jun 26, 2013 at 5:12 PM, Richard Abrich <abri...@gmail.com> wrote:
>
>> Sorry for the deluge of emails. I wasn't able to successfully get the
>> latest version of the VMTK source to run properly, so instead I just
>> downloaded the latest version of vmtkImageInitialization.py, which accepts
>> the parameters you specified.
>>
>> My question is this: the description for the SourcePoints parameter is
>> "list of source point IJK coordinates". Am I able to specify more than one
>> SourcePoint and TargetPoint, and have it iterate over them? The alternative
>> would be to save the results to disk after each call and then merge them
>> all at the end before performing the LevelSetSegmentation, which seems
>> pretty hacky.
>>
>>
>>
>> On Wed, Jun 26, 2013 at 11:07 AM, Richard Abrich <abri...@gmail.com>wrote:
>>
>>> Hi again,
>>>
>>> I noticed that the latest version of VMTK in the Github repo has those
>>> parameters you specified. I'm currently compiling it, and will let you know
>>> how it goes.
>>>
>>> Thanks,
>>> Richard
>>>
>>>
>>>
>>> On Tue, Jun 25, 2013 at 5:37 PM, Richard Abrich <abri...@gmail.com>wrote:
>>>
>>>> Hi Luca,
>>>>
>>>> Sorry I forgot to CC my last email to the mailing list.
>>>>
>>>> A couple of addendums to my previous email (below):
>>>>
>>>> 1) I converted my data to the .mha format and am using the exact
>>>> command you suggested.
>>>>
>>>> 2) I used vmtk-exe.pyc instead of vmtk-exe.pyw in order to view the
>>>> output. The relevant lines seem to be:
>>>>
>>>> Parsing options vmtkimageinitialization
>>>> vmtkimageinitialization error: unknown option -interactive
>>>>
>>>> Just FYI, here is the revision information in the
>>>> vmtkimageinitialization.py script:
>>>>
>>>> ## Date:      $Date: 2006/05/31 10:51:21 $
>>>> ## Version:   $Revision: 1.19 $
>>>>
>>>> Is there a newer version I can grab from somewhere?
>>>>
>>>>
>>>> On Tue, Jun 25, 2013 at 5:13 PM, Richard Abrich <abri...@gmail.com>wrote:
>>>>
>>>>> Hi Luca,
>>>>>
>>>>> Thanks so much for your help. I have a couple of questions:
>>>>>
>>>>> 1) My data isn't .mha format, but rather stored as a dicom set. I
>>>>> tried to do something like this instead:
>>>>>
>>>>> vmtkimagereader -f dicom -d C:/DICOM --pipe vmtkimageinitialization
>>>>> -interactive 0 -method collidingfronts -lowerthreshold 200.0 -sourcepoints
>>>>> 54 25 12 -targetpoints 89 60 24 --pipe vmtklevelsetsegmentation 
>>>>> -iterations
>>>>> 200  -advection 1.0  -curvature 0.1  -propagation 0.0  -ofile C:/out.vtk
>>>>>
>>>>> However, the output file wasn't written, and I'm not sure how to check
>>>>> whether anything happened.
>>>>>
>>>>> 2) On a related note, I notice that in your example, you specify the
>>>>> ifile parameter for vmtklevelsetsegmentation again, even though you are
>>>>> piping the results from vmtkimageinitialization. Is this necessary? How 
>>>>> can
>>>>> I do this using dicom sets instead?
>>>>>
>>>>> 3) A few of the parameters you specify for vmtkimagereader (e.g.
>>>>> interactive, method, lowerthreshold, sourcepoints, targetpoints) aren't
>>>>> listed in the documentation at
>>>>> http://www.vmtk.org/VmtkScripts/vmtkimageinitialization/ . I can see
>>>>> that LowerThreshold and UpperThreshold are properties of the
>>>>> vmtkImageInitialization object in vmtkImageInitialization.py, but the 
>>>>> other
>>>>> parameters are a mystery. Where can I read more about them?
>>>>>
>>>>> Thanks again,
>>>>> Richard
>>>>>
>>>>>
>>>>> On Thu, Jun 20, 2013 at 4:41 PM, Luca Antiga 
>>>>> <luca.ant...@orobix.com>wrote:
>>>>>
>>>>>> Hi Richard,
>>>>>>   indeed there is a way. The initialization phase in
>>>>>> vmtklevelsetsegmentation is performed by vmtkimageinitialization,
>>>>>> which accepts parameters at the command line and whose output can be
>>>>>> piped to vmtklevelsetsegmentation (in which
>>>>>> case the latter will use the initialized level sets generated by the
>>>>>> former). vmtklevelsetsegmentation can also run
>>>>>> non-interactively by specifying iterations and evolution parameters
>>>>>> at the command line. Here's a sample pipe:
>>>>>>
>>>>>> vmtkimageinitialization -ifile your_image_file.mha -interactive 0
>>>>>> -method collidingfronts -lowerthreshold 200.0 -sourcepoints 54 25 12
>>>>>> -targetpoints 89 60 24 --pipe vmtklevelsetsegmentation -ifile
>>>>>> you_image_file.mha -iterations 500 -advection 1.0 -curvature 0.1
>>>>>> -propagation 0.0 -ofile level_set_file.mha
>>>>>>
>>>>>> One caveat: sourcepoints and targetpoints are in IJK coordinates
>>>>>> (i.e. voxel indices), not physical coordinates.
>>>>>>
>>>>>> Hope this helps,
>>>>>>
>>>>>>
>>>>>> Luca
>>>>>>
>>>>>>
>>>>>> On Jun 18, 2013, at 10:51 PM, Richard Abrich wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm interested in calling vmtkLevelSetSegmentation from a script. I
>>>>>> want to run colliding fronts with arbitrary thresholds and start/end
>>>>>> position vectors for the initial segmentation, and then run the level set
>>>>>> segmentation with arbitrary parameters.
>>>>>>
>>>>>> Unfortunately, there doesn't seem to be any way to specify these
>>>>>> parameters from the command line. What might be the easiest way to
>>>>>> accomplish this?
>>>>>>
>>>>>> Thanks,
>>>>>> Richard
>>>>>> ------------------------------------------------------------------------------
>>>>>> This SF.net email is sponsored by Windows:
>>>>>>
>>>>>> Build for Windows Store.
>>>>>>
>>>>>>
>>>>>> http://p.sf.net/sfu/windows-dev2dev_______________________________________________
>>>>>> vmtk-users mailing list
>>>>>> vmtk-users@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/vmtk-users
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to