[Insight-users] Label Image question again...

Anja Ende anja.ende at googlemail.com
Tue May 20 11:20:33 EDT 2008


Hello again......

I tried using the BlobSpatialObject filter but it does not seem to be
able to converting the whole region enclosed by the ROI but only the
boundaries...

So, my code is as follows:

// Create the Blob object
typedef itk::BlobSpatialObject<3>  BlobType;
typedef BlobType::Pointer BlobPointer;
typedef itk::SpatialObjectPoint<3> BlobPointType;

BlobType::PointListType list;
for(int i=0; i<myPoints.size(); i++)
{
   BlobPointType p;
   p.SetPosition(myPoints[i].x, myPoints[i].y, myPoints[i].z);

   // This confused me as well... I just want grayscale values, so
   // I set all to 1.
   p.SetRed(1);
   p.SetGreen(1);
   p.SetBlue(1);

   list.push_back(p);
}

BlobPointer blob = BlobType::New();
blob->GetProperty()->SetName("Anja blob");
blob->SetId(1);
blob->SetPoints(list);

However, now this would only set the intensities of the border pixels,
right? The vertices that my point describe. What I was hoping for is
somewhere where I can specify this boundary and the region contained
by this boundary would be filled with 1 and the background could be 0.

Is there any class in ITK that can do that? So, I am specifying the
boundary of the 2D or 3D ROI and the ITK class hopefully could
generate me a binary image which would have the pixels in the ROI
filled with a particular intensity value (1 for example) and the
background as 0 (for example).

I hate to send so many mails to the newsgroup and I apologize for
that. However, this seemingly simple task has taken me weeks now and I
am really frustrated and have got nowhere.

Apologies again!

Cheers,
Anja




2008/5/20 Anja Ende <anja.ende at googlemail.com>:
> Hi Richard,
>
> Yes, the region conversion is where I am stuck!
>
> The points indeed do represent the vertices of the 2D polygon and
> drawing a line through these points would give the shape.
>
> Cheers,
> Anja
>
> 2008/5/20 Richard Beare <richard.beare at gmail.com>:
>> Hi,
>>
>> I attempted to answer this before, but obviously wasn't clear enough.
>>
>> The critical step seems to be the point to region conversion, which
>> depends on the meaning of the user defined points. So are these points
>> corners of a polygon? i.e. if you drew lines in an image (assuming 2D)
>> from the point 1 to 2, 2 to 3 ... and finally n to 1 to give you a
>> closed shape, would those lines represent the outline of the shape you
>> are interested in?
>>
>> On Tue, May 20, 2008 at 8:55 PM, Xabier Artaechevarria Artieda
>> <xabiarta at unav.es> wrote:
>>> You can use:
>>>
>>> http://www.itk.org/Doxygen34/html/classitk_1_1SpatialObjectToImageFilter.html
>>>
>>> However, that will give you separate points, not a contiguous irregular
>>> binary shape.
>>> I do not know of any filter that can do that, it might be that you have to
>>> implement this.
>>>
>>> Maybe somebody can help here?
>>>
>>> --
>>> Xabier Artaechevarria
>>> Cancer Imaging Laboratory
>>> Centre for Applied Medical Research
>>> www.cima.es
>>>
>>>
>>>
>>> Anja Ende <anja.ende at googlemail.com> ha escrito:
>>>
>>>> Hi,
>>>>
>>>> Actually spoke too soon! Do not see how I can convert this
>>>> BlobSpatialObject to a binary itk::Image.
>>>>
>>>> It seems to be very difficult to be able to create a binary image by
>>>> hand unless you use one of the itk filters...
>>>>
>>>> Cheers,
>>>> Anja
>>>>
>>>> 2008/5/20 Anja Ende <anja.ende at googlemail.com>:
>>>>>
>>>>> Hi Xabi,
>>>>>
>>>>> Thanks for your reply!
>>>>>
>>>>> 4. So, now the problem is how to compute a binary region from those
>>>>> points. What do you want exactly? Is it the bounding box? You can get
>>>>> this with SpatialObjects (BlobSpatialObject).
>>>>>
>>>>> I actually need the shape that the points represent. It is not really
>>>>> a rectangle but an irregular shape. I think the BlobSpatialObject
>>>>> might be the thing that I need as it seems to be able to represent any
>>>>> amorphous shape. I will give this a shot now!
>>>>>
>>>>> Cheers,
>>>>> Anja
>>>>>
>>>>> 2008/5/20 Xabier Artaechevarria Artieda <xabiarta at unav.es>:
>>>>>>
>>>>>> Hi Anja,
>>>>>>
>>>>>> Let's see if I can help a bit with some points.
>>>>>>
>>>>>> 1. The article you mentioned is an Insight Journal contribution.  As
>>>>>> such, it
>>>>>> includes the code needed to reproduce the results. You need this  code,
>>>>>> which
>>>>>> you can find in
>>>>>>
>>>>>> http://insight-journal.org/InsightJournalManager/view_reviews.php?pubid=176.
>>>>>> This includes the LabelImage class, the classes to convert different
>>>>>> images
>>>>>> to a LabelMap, and so on.
>>>>>>
>>>>>> 2. At least that I know, there is no straighforward way to create a
>>>>>> LabelImage based on a user defined contour. What you need, though, is a
>>>>>> LabelMap.
>>>>>>
>>>>>> 3. You must do it in two steps. First convert your points to binary
>>>>>> image,
>>>>>> and then this image to a label map. You can convert a Binary image to a
>>>>>> label map easily with the itkBinaryImageToBinaryMapFilter.
>>>>>>
>>>>>> 4. So, now the problem is how to compute a binary region from those
>>>>>> points.
>>>>>> What do you want exactly? Is it the bounding box? You can get this with
>>>>>> SpatialObjects (BlobSpatialObject).
>>>>>>
>>>>>> Hope that helps,
>>>>>> Xabi
>>>>>>
>>>>>> --
>>>>>> Xabier Artaechevarria
>>>>>> Cancer Imaging Laboratory
>>>>>> Centre for Applied Medical Research
>>>>>> www.cima.es
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anja Ende <anja.ende at googlemail.com> ha escrito:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I am really frustrated at my inability to achieve this and hope
>>>>>>> someone can help me with a few lines of code on how to achieve this:
>>>>>>>
>>>>>>> - I have an itk::Image object and a set of points in the image
>>>>>>> coordinates that represent a ROI.
>>>>>>> - I cannot for saving my life figure out how to generate a LabelObject
>>>>>>> based on this.... I have had some help when I asked this question
>>>>>>> before but there seems to be a disconnect somewhere and I am missing a
>>>>>>> step.
>>>>>>>
>>>>>>> I guess I have to figure out a way to render the region defined by
>>>>>>> these points into another image and somehow use this image as a mask
>>>>>>> on the original image. However, I just do not know how to achieve this
>>>>>>> with the ITK classes. The document entitled "Label Object
>>>>>>> representation and manipulation with ITK" somehow (I think) assumes
>>>>>>> that the LabelImage is easily created, but I am finding it very
>>>>>>> difficult to actually create this LabelImage!
>>>>>>>
>>>>>>> Is there any documentation on how one can create a LabelImage based on
>>>>>>> a user defined contour???
>>>>>>>
>>>>>>> Please help!
>>>>>>>
>>>>>>> --
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Anja
>>>>>>> _______________________________________________
>>>>>>> Insight-users mailing list
>>>>>>> Insight-users at itk.org
>>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ----------------------------------------------------------------
>>>>>> Este mensaje ha sido enviado desde https://webmail.unav.es
>>>>>>
>>>>>> _______________________________________________
>>>>>> Insight-users mailing list
>>>>>> Insight-users at itk.org
>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Cheers,
>>>>>
>>>>> Anja
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>>
>>>> Anja
>>>>
>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> Este mensaje ha sido enviado desde https://webmail.unav.es
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>
>
>
> --
> Cheers,
>
> Anja
>



-- 
Cheers,

Anja


More information about the Insight-users mailing list