[Rtk-users] Is there a way to signal to rtk-ProjectionsReader that RawImage has files and columns transposed?
Simon Rit
simon.rit at creatis.insa-lyon.fr
Mon May 16 14:56:41 UTC 2022
Hi Fernando,
No, there is no way to transpose your projections. It should be fairly easy
to add (in the ProjectionsReader) or to do it before hand with itk. Any
contribution to RTK is welcomed.
Now, I'm not sure I follow the long explanation. Is the reconstruction
transposed or the projections? If it's the former, so what you really want
is to transpose the reconstructed volume. You can do this by setting a
rotation matrix to the reconstructed volume with the --direction option of
rtkfdk.
Simon
On Mon, May 16, 2022 at 4:29 PM Fernando Hueso González <
fernando.hueso at uv.es> wrote:
> Hello RTK-users,
>
> as a newbie, I am not yet familiar with the way how to correctly use RTK,
> so my apologies if I am asking something dumb.
>
> My question is (short version):
>
> Is there a way to use rtk::ProjectionsReader with images that have files
> and columns transposed with respect to the convention (wrt the rotation
> axis)? And if not, would it be possible to add such a feature in the future?
>
> The long story:
>
> Currently, I am trying to migrate a script I wrote in MATLAB, which
> correctly performs a 3D reconstruction based on 360 projections (2D). Thus,
> I am sure that my geometry parameters and input data are correct. I open
> them exaclty in the same format both in MATLAB and in RTK (as uint16).
>
> The MATLAB script does something like this (The flip below is because
> projections go from 0, -1, -2, ... degrees):
>
> ctWidth = 768 ctHeight = 486 pitch = 0.075*4 allProjections =
> zeros(ctWidth,ctHeight,ctProjections,'uint16'); for proj = 1:ctProjections
> allProjections(:,:,proj) =
> fread(fopen(projfile(proj),'rb','l'),[ctWidth,ctHeight],'uint16'); end Di =
> 90; % isocenter to detector distance mm Ds = 151; % isocenter to source
> distance mm offset = 1.6; % mm for i = 1:ctHeight Ifan(i) = ifanbeam(
> ...
> log(16383./flip(single(squeeze(allProjections(round(offset*2/pitch):end,i,:))),2)),
> ... Ds/pitch, ... 'FanSensorSpacing',Ds/(Di+Ds), ...
> 'FanSensorGeometry','line', ... 'Filter', 'Hann', ...
> 'OutputSize', 700); end
>
> And after saving Ifan, it correctly generates a 3D image that I can open
> with Slicer3D. ( A cylinder with some wires).
>
> Now, if I try to do the same thing with RTK in C++, I cannot seem to find
> the proper settings to do the exact same reconstruction. First I try to
> define the geometry and input format:
>
> using GeometryType = rtk::ThreeDCircularProjectionGeometry;
>
> GeometryType::Pointer geometry = GeometryType::New();
>
> for (size_t i = 0; i < 360; i++) {
>
> const float angle = -i;
>
> const float sid = 151;
>
> const float sdd = 90+151;
>
> geometry->AddProjection(sid, sdd, angle, 1.6);
>
> }
> ImageIOType::Pointer io = ImageIOType::New(); io->SetDimensions(0, ctWidth); io->SetDimensions(1, ctHeight); io->SetByteOrderToLittleEndian(); io->SetOrigin(0, -detPitchU * detSizeU / 2); io->SetOrigin(1, -detPitchV * detSizeV / 2); io->SetSpacing(0, detPitchU * binningU); io->SetSpacing(1, detPitchV * binningV);
>
> using NameGeneratorType = itk::NumericSeriesFileNames; NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New(); nameGenerator->SetSeriesFormat(subfolder + "/%d.ct"); nameGenerator->SetStartIndex(0); nameGenerator->SetEndIndex(359); nameGenerator->SetIncrementIndex(1);
>
>
> using ReaderType = rtk::ProjectionsReader<OutputImageType>;
>
> ReaderType::Pointer reader = ReaderType::New();
>
> reader->SetFileNames(nameGenerator->GetFileNames());
>
> reader->SetImageIO(io);
>
> reader->SetI0(16383);
>
> reader->Update();
>
> After reconstructing, it looks then transposed with respect to the MATLAB
> version. The circular section is on the right, and the vertical cylinder on
> the left. (Sorry about it not being centered, that's my bad.). (Changing
> 'nColumns' with 'nRows' of course does not solve the issue, as this would
> lead to wrong 2D images being imported.)
>
> So the question would be if there is a way to solve this without having to
> mess around with my data. Maybe there is a 'transpose flag' that I have
> overlooked when calling rtk-projectionsreader? If you prefer, I can share
> with you the full script and input data via my Cloud-Drive.
>
> Thanks in advance for the help! Have a nice weekend.
>
> Fernando.
> _______________________________________________
> Rtk-users mailing list
> Rtk-users at public.kitware.com
> https://public.kitware.com/cgi-bin/mailman/listinfo/rtk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220516/a8f8282e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rPi4JCNyfeRHibCs.png
Type: image/png
Size: 149705 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220516/a8f8282e/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ePeBVtJM83MMDGhb.png
Type: image/png
Size: 181873 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220516/a8f8282e/attachment-0003.png>
More information about the Rtk-users
mailing list