[Insight-users] Signed Danielsson

Einstein, Daniel R daniel.einstein at pnl.gov
Thu Oct 20 19:16:50 EDT 2005


Hi Zach,

Without experience with the Danielsson filter I suspected the same
thing: I was looking at the filter of a blank screen. That helps me
isolate the problem. I'll see about the cast problem and let you know.

Thanks Again

Dan 


Daniel R Einstein, PhD
Biological Monitoring and Modeling
Pacific Northwest National Laboratory
P.O. Box 999; MSIN P7-58
Richland, WA 99352
Tel: 509/ 376-2924
Fax: 509/376-9064
daniel.einstein at pnl.gov


-----Original Message-----
From: Zachary Pincus [mailto:zpincus at stanford.edu] 
Sent: Thursday, October 20, 2005 12:10 PM
To: Einstein, Daniel R
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Signed Danielsson

Without actually looking at the output I can't say much -- the output
distance map on the screenshot looks like what you would see if you
passed the filter a blank image.

The Danielsson filter works fine in my hands with similar data; I
suspect that perhaps there's a problem with the prescaling, etc? I would
try standard debugging things: try replacing the danielsson filter with
a cast-to-float filter to see if your input comes through the
prescaling, etc. unmolested. The Danielsson filter requires an image
with zero-valued pixels "outside" and non-zero-valued pixels "inside".

Also just try writing a trivial executable that **only** reads in your
mha file, passes it to the Danielsson filter and writes out the result.
(This really should work.) You know -- the standard "isolate-
the-problem" debugging approach.

Zach


On Oct 20, 2005, at 12:04 PM, Einstein, Daniel R wrote:

>
> Hi Zach,
>
> Thanks for the reply. Try this:
>
>
> ftp://ftp.radiology.uiowa.edu/skabilan/SignedDanielsson
>
> username: guestftp
> password:go_hawks
>
> Does it matter if the input image is unsigned or not?
>
> Dan
>
>
> Daniel R Einstein, PhD
> Biological Monitoring and Modeling
> Pacific Northwest National Laboratory
> P.O. Box 999; MSIN P7-58
> Richland, WA 99352
> Tel: 509/ 376-2924
> Fax: 509/376-9064
> daniel.einstein at pnl.gov
>
>
> -----Original Message-----
> From: Zachary Pincus [mailto:zpincus at stanford.edu]
> Sent: Thursday, October 20, 2005 9:58 AM
> To: Einstein, Daniel R
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Signed Danielsson
>
> The FTP server doesn't seem to be working particularly well -- the FTP
> data port (as opposed to the control port) seems to be blocked.
> Or perhaps it's a permissions issue. I've tried it with several  
> clients
> in several locations where I know FTP to be working otherwise. Can you
> post to a web server somewhere?
>
> In general, I suggest reviewing the doxygen man pages / headers for  
> the
> signed Danielsson filter and it's unsigned relative to make sure you
> understand the parameters and are setting them correctly. Also, try to
> see if you can compute an un-signed distance map on your input.  
> Finally,
> as per ITK level-set convention, the "inside" of the signed  
> distance map
> will be negative and "outside" regions will be positive.
>
> If you could describe in a bit more detail your inputs and outputs (or
> if you could post them to the web) I'll try to help more.
>
> Zach
>
>
> On Oct 20, 2005, at 11:01 AM, Einstein, Daniel R wrote:
>
>
>>
>> Hello friends,
>>
>> I am trying to compute the Euclidean distance map on a binary volume
>> and am getting weird results.
>>
>> Data is available at ftp://ftp.pnl.gov/outgoing/SignedDanielsson
>>
>> See Screenshot.png for a look at what the cross section looks like.
>> This is a simplification, but basically the volume is a cylinder of
>> that cross-section. ScreenShot2.png shows the result of the Signed
>> Danielsson Map - not what I expected. I expected zero to be the
>> border; negative to be 'outside'; and positive to be 'inside'.  
>> Sort of
>>
>
>
>> like and image within an image. Reduced.mha is the header and
>> reduced.raw.zip is the image. It is a binary image of 1 and 11 - I
>> pass the image as floats to the itkSignedDanielssonFilter. Am I
>> expecting the wrong thing or doing it wrong.
>>
>> Any help would be greatly appreciated.
>>
>> Dan
>>
>> See code snippet below.
>>
>> //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> ++++++++++++
>> // ITK Signed Danielsson Distance Map
>> //
>> void ThreeDFilters::distanceFilter(float *ddvimage, int xdim, int
>> ydim, int zdim,
>>                                       int numiter, QApplication *app)
>> { // // //
>> *********************************************************************

>> *
>> *
>> //         Preliminaries to copy the  ddv array into an ITK Image
>> type   *
>> //
>> *********************************************************************

>> *
>> *
>> //
>> //              Pass the dimensions and type of ddv array
>>   typedef float PixelType;
>>   const unsigned int Dimension = 3;
>>   typedef itk::Image< PixelType, Dimension > ImageType;
>>   typedef itk::Image< float, 3 > ImageType;
>>
>> // image origin
>>   float ox = 0.0;
>>   float oy = 0.0;
>>   float oz = 0.0;
>> // pixel spacing
>>   float dx = 1.0;
>>   float dy = 1.0;
>>   float dz = 1.0;
>>
>>   ImageType::Pointer itkimage = ImageType::New();
>>    ImageType::SizeType size;   size[0] = xdim;   size[1] = ydim;
>>   size[2] = zdim;
>>    ImageType::IndexType start;   start[0] = 0;   start[1] = 0;
>>   start[2] = 0;
>>    ImageType::RegionType region;   region.SetSize( size );
>> region.SetIndex( start );   itkimage->SetRegions( region);
>>    itkimage->Allocate();
>>    double spacing[3];   spacing[0] = dx;   spacing[1] = dy;
>>   spacing[2] = dz;   itkimage->SetSpacing( spacing );
>>    double origin[3];   origin[0] = ox;   origin[1] = oy;
>>   origin[2] = oz;   itkimage->SetOrigin( origin );
>>    typedef itk::ImageRegionIterator< ImageType> IteratorType;
>> IteratorType it( itkimage, region );   it.GoToBegin();   float *
>> data = ddvimage;   while( ! it.IsAtEnd() )     {     it.Set
>> ( *data);     ++it;     ++data;     }
>>
>> // ****************************************************************
>> //                      End preliminaries                         *
>> // ****************************************************************
>> //
>> //  typedef itk::RescaleIntensityImageFilter<
>> //              ImageType, ImageType > preRescaleFilterType;
>> //  preRescaleFilterType::Pointer prerescaler =
>> preRescaleFilterType::New();
>> //  prerescaler->SetOutputMinimum(   0 );
>> //  prerescaler->SetOutputMaximum( 255 ); //  prerescaler->SetInput(
>> itkimage ); //
>> //       SIGNED DISTANCE MAP WITH AUTOMATIC RESCALING
>>   typedef    float    OutputPixelType;
>>   typedef itk::Image< OutputPixelType, 3 >   OutputImageType;
>>   typedef itk::SignedDanielssonDistanceMapImageFilter<
>>                                          ImageType,
>>                                          OutputImageType >
>> FilterType;
>>   FilterType::Pointer filter = FilterType::New();
>>   filter->SetInput( itkimage );
>>
>>   typedef itk::RescaleIntensityImageFilter<
>>               OutputImageType, OutputImageType > RescaleFilterType;
>>   RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
>>   rescaler->SetOutputMinimum(   0L );
>>   rescaler->SetOutputMaximum( 65535L );
>>   rescaler->SetInput( filter->GetOutput() ); // // //
>> **************************************************************
>> //                          End Filter                          *
>> // **************************************************************
>> //
>> // **************************************************************
>> // Begin Conclusion: This writes the image back to the local    *
>> // buffer and should be written as a generic callable function  * //
>> **************************************************************
>> //
>>   PixelType* pixelData= static_cast<PixelType* >(ddvimage);   const
>> bool filterWillDeleteTheInputBuffer = false;   const unsigned int
>> totalNumberOfPixels = xdim*ydim*zdim;   rescaler->GetOutput()-
>>
>>> GetPixelContainer()->SetImportPointer(pixelData,
>>>
>> totalNumberOfPixels,filterWillDeleteTheInputBuffer);   rescaler-
>>
>>> GetOutput()->Allocate();   rescaler->Update();
>>>
>>
>> //
>> //
>> printf("done ITK Signed Danielsson Distance Map\n");
>>   if ( pd ) {
>>     delete pd;
>>     QApplication::restoreOverrideCursor();
>>   }
>>
>> }
>> Daniel R Einstein, PhD
>> Biological Monitoring and Modeling
>> Pacific Northwest National Laboratory
>> P.O. Box 999; MSIN P7-58
>> Richland, WA 99352
>> Tel: 509/ 376-2924
>> Fax: 509/376-9064
>> daniel.einstein at pnl.gov
>>
>>
>>
>> Daniel R Einstein, PhD
>> Biological Monitoring and Modeling
>> Pacific Northwest National Laboratory
>> P.O. Box 999; MSIN P7-58
>> Richland, WA 99352
>> Tel: 509/ 376-2924
>> Fax: 509/376-9064
>> daniel.einstein at pnl.gov
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>



More information about the Insight-users mailing list