[Rtk-users] insert .dcm

Simon Rit simon.rit at creatis.insa-lyon.fr
Tue Apr 7 12:37:31 EDT 2015


Dear Safdary,
Thank you for sharing your code and the projections. I don't understand
them either... I don't know where they are from and but they seem to be of
very different nature. Image 1.dcm has air in black and object in white
with pixel values between 0 and 255 while 49.dcm is the other way around.
In any case, we won't figure it out for you, this is where we can't help
you and you must figure it out yourself.
It's a good thing that you did not manage to transfer the dicom files
because they were not anonymized. Please be careful.
Simon

On Tue, Apr 7, 2015 at 3:17 PM, safdary mohsen <ieee.safdary at gmail.com>
wrote:

> Hi
> My code for Reconstruction is shown in the following
> this code work very well for .hnd and .his projection but when i insert
> .dcm projection, the output(reconstructed image) is black completely
> please solve this problem for me(10 .dcm projections and reconstructed
> image(just one slice) are attached to mail)
>
>
> int main(int , char **)
> {
>
>   //// variable
>   typedef itk::Image< float, 3 > ImageType;
>   typedef rtk::ConstantImageSource< ImageType > ConstantImageSourceType;
>
> /////////////////////////////////////////////////////////////////////////////////////////////////////
>   // Generate file names of projections
>   itk::RegularExpressionSeriesFileNames::Pointer names =
> itk::RegularExpressionSeriesFileNames::New();
>
> names->SetDirectory(std::string("E://RTK/RTK-BUILD/bin/Debug/dcmprojection/"));
>   names->SetRegularExpression(std::string(".*.dcm"));
>
>   //// set projection file
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////
>   //// geometry
>   // Defines the RTK geometry object
>    typedef rtk::ThreeDCircularProjectionGeometry GeometryType;
>   GeometryType::Pointer geometry = GeometryType::New();
>
>   // Projection matrices
>   unsigned int numberOfProjections = 10;
>   unsigned int firstAngle = 0;
>   unsigned int angularArc = 360;
>   unsigned int sid = 1000; // source to isocenter distance in mm
>   unsigned int sdd = 1500; // source to detector distance in mm
>   int isox = 0; // X coordinate on the projection image of isocenter
>   int isoy = 0; // Y coordinate on the projection image of isocenter
>
>   for(unsigned int noProj=0; noProj<numberOfProjections; noProj++)
>     {
>     double angle = (float)firstAngle + (float)noProj * angularArc /
> (float)numberOfProjections;
>     geometry->AddProjection(sid,
>                             sdd,
>                             angle,
>                             isox,
>                             isoy);
>     }
>
>
> /////////////////////////////////////////////////////////////////////////////////////////////////////
>
>  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>   // Projections reader
>
>   typedef rtk::ProjectionsReader< ImageType > ReaderType;
>   ReaderType::Pointer reader = ReaderType::New();
>   reader->SetFileNames(names->GetFileNames());
>
>
>  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>    // Create reconstructed image
>                   ////////////////////////////////////
>
>   ConstantImageSourceType::Pointer constantImageSource =
> ConstantImageSourceType::New();
>   ConstantImageSourceType::PointType origin;
>   ConstantImageSourceType::SpacingType spacing;
>   ConstantImageSourceType::SizeType sizeOutput;
>
>   origin[0] = -127.75;//12.875
>   origin[1] = -127.75;//30
>   origin[2] = -127.75;//12.875
>
>   // Adjust size according to geometry
>   sizeOutput[0] = 512;//512
>   sizeOutput[1] = 512;
>   sizeOutput[2] = 512;
>
>   spacing[0] = .5;//.25
>   spacing[1] = .5;
>   spacing[2] = .5;
>
>   constantImageSource->SetOrigin( origin );
>   constantImageSource->SetSpacing( spacing );
>   constantImageSource->SetSize( sizeOutput );
>   constantImageSource->SetConstant( 0. );
>
>                       //////////////////////////////////////
> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
>   std::cout << "Performing reconstruction" << std::endl;
>    // FDK reconstruction filtering
>   typedef rtk::FDKConeBeamReconstructionFilter< ImageType> FDKCPUType;
>   FDKCPUType::Pointer feldkamp = FDKCPUType::New();
>   feldkamp->SetInput( 0, constantImageSource->GetOutput() );
>   feldkamp->SetInput( 1, reader->GetOutput());
>   feldkamp->SetGeometry( geometry);
>    feldkamp->Update();
>
>   std::cout << "Writing output image" << std::endl;
>
>   // Writer
>   typedef itk::ImageFileWriter<ImageType> WriterType;
>   WriterType::Pointer writer = WriterType::New();
>   writer->SetFileName( "output11.mha" );//mha
>   //writer->SetUseCompression(true);
>   writer->SetInput( feldkamp->GetOutput() );
>   writer->Update();
>
>    std::cout << "Done" << std::endl;
>     return 0;
> }
>
> _______________________________________________
> Rtk-users mailing list
> Rtk-users at public.kitware.com
> http://public.kitware.com/mailman/listinfo/rtk-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20150407/4c33aa88/attachment-0009.html>


More information about the Rtk-users mailing list