[Insight-users] Problems with ImageMaskSpatialObject

Markus Mehrwald mehrwald at ira.uka.de
Wed Feb 21 07:46:49 EST 2007


Hi,

I found the problem. The image starts at 180, 130 and that is the 
problem. If I translate the image to 0, 0 the code from my last mail 
works correct. The problem now: I need the information of the 
translation for further calculations.
Any suggestions how to keep the translation? I tried

ImageMaskSpatialObjectType::TransformType::OffsetType offset;
offset[0] = thresholder->GetOutput()->GetRequestedRegion().GetIndex()[0];
offset[1] = thresholder->GetOutput()->GetRequestedRegion().GetIndex()[1];
imageMaskSpatialObject->GetObjectToParentTransform()->SetOffset(offset);
imageMaskSpatialObject->ComputeObjectToParentTransform();

but this leads to the same problem I had before. Also with WorldTransform.

Greetings,
Markus

Markus Mehrwald schrieb:
> Hi,
> I just implemented some code which uses a ImageMaskSpatialObject. I 
> created a binary image in my filter chain and want this now to be a 
> spatial object so I use the SetImage method of the spatial object but 
> nothing happens. The output of the object looks good. Coordinates (, 
> ...) are correct but at every point of the so created object ValueAt 
> gives me 0. The code looks like the following:
>
> thresholder->Update();
> ImageMaskSpatialObjectType::PointType point;
> imageMaskSpatialObject = ImageMaskSpatialObjectType::New();
> imageMaskSpatialObject->SetImage(thresholder->GetOutput());
> imageMaskSpatialObject->SetRequestedRegion(thresholder->GetOutput()->GetRequestedRegion()); 
>
> imageMaskSpatialObject->Update();
> imageMaskSpatialObject->UpdateOutputInformation();
> imageMaskSpatialObject->ComputeObjectToWorldTransform();
> double ret;
> for (int i = 0; i < 640; i++)
> {
>    for (int j = 0; j < 512; j++)
>    {
>        point[0] = i;
>        point[1] = j;
>        imageMaskSpatialObject->ValueAt(point, ret);
>        if (ret != 0)
>            std::cout << "ret: " << ret << std::endl;
>    }
> }
>
>
> The image coming from the thresholder has indeed a size of 300x280 but 
> changing the for-loops has no consequence on the outcome.
> I took a look at the image coming from the thresholder and it is what 
> it should be, a binary image with white areas too. The code above 
> never writes anything to the standard output because it does not find 
> any values differing to 0.
> Did I anything wrong or is it a problem of the ImageMaskSpatialObject?
>
> Thanks in advance,
> Markus
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


-- 
---------------------------------------------------------
Cand. Dipl.-Inf. Med. Markus Mehrwald
Institut für Prozessrechentechnik, Automation und Robotik

Universität Karlsruhe (TH)
Gebäude 40.28
Engler-Bunte-Ring 8
76131 Karlsruhe

E-Mail: mehrwald at ira.uka.de
---------------------------------------------------------



More information about the Insight-users mailing list