[Insight-users] Raw images reader

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Apr 29 09:18:35 EDT 2013


Hello Thibault,

That is really not enough information for anyone to be able to help you.

Please provide a code snippet of what you tried to do. What do you expect the result to be, and what did you get as output? Also how did you examine your output?

Also keep in mind the standard SimpleITK representation of a binary image output ( frequently from threshold based segmentations ) is an unint8_t image of 0s and 1s. Many images viewers will appear to just show a black image when the content is actually there.

Brad

On Apr 29, 2013, at 4:19 AM, Thibault Varacca <thibault.varacca at gmail.com> wrote:

> I tried to apply CastImageFilter 8bit -> 32 bit float but nothing worked ...
> 
> 
> 2013/4/29 Thibault Varacca <thibault.varacca at gmail.com>
> Hi, 
> yes it works better ... 
> I have also another problem:  i have a 32-bit float image in input and the filter generates an image of 8-bit unsigned integer. I want to have 32-bit float in output.
> Any way to do this?
> Thanks !
> 
> 
> 2013/4/26 Bradley Lowekamp <blowekamp at mail.nih.gov>
> Hello,
> 
> It appears you are not actually setting the seeds to the filter. There are two methods to choose from in C++:
> 
> Self & 	SetSeed (std::vector< unsigned int > idx)
> Self & 	SetSeedList (std::vector< std::vector< unsigned int > > t)
> 
> What you have as variable "seedList" is really just a single seed. In Java the types of the arguments for the above methods should be VectorUInt32, and VectorUIntList respectfully. You should be able to use the first one with your current variable.
> 
> Brad
> 
> 
> On Apr 26, 2013, at 10:48 AM, Thibault Varacca <thibault.varacca at gmail.com> wrote:
> 
>> Ok the .mhd way to do this worked great.
>> 
>> I have to do 3D segmentation on raw images. I tryed to do this with the ThresholdImageFilter but all my values are at zero after applying the filter ...
>> My Raw images are Float32 3D 128x128x128, here is my code :
>> 
>> import org.itk.simple.ConnectedThresholdImageFilter;
>> import org.itk.simple.Image;
>> import org.itk.simple.ImageFileReader;
>> import org.itk.simple.ImageFileWriter;
>> import org.itk.simple.VectorUInt32;
>> 
>> public class ImageReader {
>> 
>>     private static String inputFilename = "fdk.xy.mhd";
>>     private static String outputFilename = "output.mhd";
>> 
>>     public static void main(String[] args) {
>> 
>>         VectorUInt32 seedList = new VectorUInt32(3);
>>         ImageFileReader reader = new ImageFileReader();
>>         ImageFileWriter writer = new ImageFileWriter();
>>         ConnectedThresholdImageFilter filter = new ConnectedThresholdImageFilter();
>> 
>>         reader.setFileName(inputFilename);
>>         writer.setFileName(outputFilename);
>> 
>>         Image input = reader.execute();
>> 
>>         /* valeurs de seuil */
>>         filter.setLower(0.003);
>>         filter.setUpper(5);
>>         filter.setReplaceValue((short) 5);
>> 
>>         /* seed points */
>>         seedList.clear();
>>         seedList.push_back(100);
>>         seedList.push_back(16);
>>         seedList.push_back(46);
>> 
>> 
>>         Image output = filter.execute(input);
>>         writer.execute(output);
>> 
>>     }
>> 
>> Do you know how to make it work?
>> 
>> Thank you !
>> 
>> 
>> 2013/4/26 Samuel Pichardo <sammeuly at gmail.com>
>> Hi
>> 
>> In Python, you could use rather numpy io function 
>> http://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html
>> and convert the arrays to simpleITK with 
>> SimpleITK.GetImageFromArray
>> 
>> Regards
>> 
>> Sam
>> 
>> 
>> On 2013-04-26, at 4:59 AM, Thibault Varacca <thibault.varacca at gmail.com> wrote:
>> 
>>> Dear all, 
>>> I'm looking to load and read raw images with simpleITK but I didn't find any RawReader(). 
>>> How can i do this?
>>> Thanks !
>>> 
>>> -- 
>>> Thibault Varacca
>>> EFREI Promo 2014
>>> 06 60 53 11 35
>>> _____________________________________
>>> Powered by www.kitware.com
>>> 
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>> 
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>> 
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>> 
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>> 
>> 
>> 
>> 
>> -- 
>> Thibault Varacca
>> EFREI Promo 2014
>> 06 60 53 11 35
>> _____________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
> 
> -- 
> Thibault Varacca
> EFREI Promo 2014
> 06 60 53 11 35
> 
> 
> 
> -- 
> Thibault Varacca
> EFREI Promo 2014
> 06 60 53 11 35

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130429/b7711d66/attachment.htm>


More information about the Insight-users mailing list