From vl at xris.eu Mon Jun 11 12:35:48 2018 From: vl at xris.eu (vincent) Date: Mon, 11 Jun 2018 18:35:48 +0200 Subject: [Rtk-users] Compile custom application Message-ID: <598a27a5-256a-46fa-2f8d-8b9f8cd79832@xris.eu> Hello everyone, I wanted to create a small application to simulate a geometry for a tomosynthesis acquisition scanner whose source displacement is along the x axis only. I created a rtksimulatedtomogeometry directory in the rtk/applications folder made a few changes to rtksimulatedgeometry. I added the corresponding line in the CMakeList.txt in the rtk/applications folder. When I recompile RTK, I get the following error message: /rtksimulatedtomogeometry.cxx:19:42: fatal error: rtksimulatedtomogeometry_ggo.h: No such file or directory Indeed, this file does not exist but I could not find any rtkXXX_ggo.h in my sources folder. Could someone please tell me what I missed ? I attached the three files I modified if it can be of any help. If I can make it work, I would be happy to share it with the rest of the RTK community. Thank you for your help, Kindest regards, Vincent -------------- next part -------------- WRAP_GGO(rtksimulatedtomogeometry_GGO_C rtksimulatedtomogeometry.ggo ${RTK_BINARY_DIR}/rtkVersion.ggo) add_executable(rtksimulatedtomogeometry rtksimulatedtomogeometry.cxx ${rtksimulatedgeometry_GGO_C}) target_link_libraries(rtksimulatedtomogeometry RTK) #Installation code if(NOT RTK_INSTALL_NO_EXECUTABLES) foreach(EXE_NAME rtksimulatedtomogeometry) install(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${RTK_INSTALL_RUNTIME_DIR} COMPONENT Runtime LIBRARY DESTINATION ${RTK_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries ARCHIVE DESTINATION ${RTK_INSTALL_ARCHIVE_DIR} COMPONENT Development) endforeach() endif() -------------- next part -------------- A non-text attachment was scrubbed... Name: rtksimulatedtomogeometry.cxx Type: text/x-c++src Size: 2212 bytes Desc: not available URL: -------------- next part -------------- package "rtksimulatedgeometry" purpose "Creates an RTK geometry file from simulated/regular trajectory." option "verbose" v "Verbose execution" flag off option "config" - "Config file" string no option "output" o "Output file name" string yes option "first_angle" f "First angle in degrees" double no default="0" option "nproj" n "Number of projections" int yes option "arc" a "Angular arc covevered by the acquisition in degrees" double no default="360" option "sdd" - "Source to detector distance (mm)" double no default="1536" option "sid" - "Source to isocenter distance (mm)" double no default="1000" option "proj_iso_x" - "X coordinate on the projection image of isocenter" double no default="0" option "proj_iso_y" - "Y coordinate on the projection image of isocenter" double no default="0" option "firstPosX" - "In-place x source position wrt to central ray" double no default="0" option "deltaX" - "Length of the tomo linear trajectory" double no default="1" option "source_y" - "In-place y source position wrt to central ray" double no default="0" option "out_angle" - "Out of plane angle" double no default="0" option "in_angle" - "In plane angle" double no default="0" option "rad_cyl" - "Radius cylinder of cylindrical detector" double no default="0" From simon.rit at creatis.insa-lyon.fr Mon Jun 11 15:19:08 2018 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Mon, 11 Jun 2018 21:19:08 +0200 Subject: [Rtk-users] Compile custom application In-Reply-To: <598a27a5-256a-46fa-2f8d-8b9f8cd79832@xris.eu> References: <598a27a5-256a-46fa-2f8d-8b9f8cd79832@xris.eu> Message-ID: Hi Vincent, _ggo.h/c are generated in the binary directory by gengetopt based on the .ggo file. In this case, your file does not seem to be generated. If you look at the CMakeLists.txt, WRAP_GGO asks gengetopt to create these files. The names of the generated files are stored in the cmake variable rtksimulatedtomogeometry_GGO_C. However, you forgot to change the variable name on line 2, rtksimulatedgeometry_GGO_C is still used. Changing it to rtksimulatedtomogeometry_GGO_C should fix your problem (well, other will appear but they'll be easier to understand). Good luck with your dev. Note that you can also do AddProjection with 3D coordinates of the source / detector positions + the coordinates of the detector coordinate axes. Simon On Mon, Jun 11, 2018 at 6:35 PM, vincent wrote: > Hello everyone, > > I wanted to create a small application to simulate a geometry for a > tomosynthesis acquisition scanner whose source displacement is along the x > axis only. > > I created a rtksimulatedtomogeometry directory in the rtk/applications > folder made a few changes to rtksimulatedgeometry. > > I added the corresponding line in the CMakeList.txt in the > rtk/applications folder. > > When I recompile RTK, I get the following error message: > > /rtksimulatedtomogeometry.cxx:19:42: fatal error: > rtksimulatedtomogeometry_ggo.h: No such file or directory > > Indeed, this file does not exist but I could not find any rtkXXX_ggo.h in > my sources folder. > > Could someone please tell me what I missed ? > > I attached the three files I modified if it can be of any help. If I can > make it work, I would be happy to share it with the rest of the RTK > community. > > Thank you for your help, > > Kindest regards, > > Vincent > > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > https://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vl at xris.eu Tue Jun 12 03:30:37 2018 From: vl at xris.eu (vincent) Date: Tue, 12 Jun 2018 09:30:37 +0200 Subject: [Rtk-users] Compile custom application In-Reply-To: References: <598a27a5-256a-46fa-2f8d-8b9f8cd79832@xris.eu> Message-ID: <09005799-d6a8-0015-8a80-66079c4b7bb4@xris.eu> Silly me... :) Thank you very much for your reply Simon.? It works now ! Best regards, Vincent On 2018-06-11 21:19, Simon Rit wrote: > Hi Vincent, > _ggo.h/c are generated in the binary directory by gengetopt based on > the .ggo file. In this case, your file does not seem to be generated. > If you look at the CMakeLists.txt, WRAP_GGO asks gengetopt to create > these files. The names of the generated files are stored in the cmake > variable rtksimulatedtomogeometry_GGO_C. However, you forgot to change > the variable name on line 2, rtksimulatedgeometry_GGO_C is still used. > Changing it to rtksimulatedtomogeometry_GGO_C should fix your problem > (well, other will appear but they'll be easier to understand). > Good luck with your dev. Note that you can also do AddProjection with > 3D coordinates of the source / detector positions + the coordinates of > the detector coordinate axes. > Simon > > On Mon, Jun 11, 2018 at 6:35 PM, vincent > wrote: > > Hello everyone, > > I wanted to create a small application to simulate a geometry for > a tomosynthesis acquisition scanner whose source displacement is > along the x axis only. > > I created a rtksimulatedtomogeometry directory in the > rtk/applications folder made a few changes to rtksimulatedgeometry. > > I added the corresponding line in the CMakeList.txt in the > rtk/applications folder. > > When I recompile RTK, I get the following error message: > > /rtksimulatedtomogeometry.cxx:19:42: fatal error: > rtksimulatedtomogeometry_ggo.h: No such file or directory > > Indeed, this file does not exist but I could not find any > rtkXXX_ggo.h in my sources folder. > > Could someone please tell me what I missed ? > > I attached the three files I modified if it can be of any help. If > I can make it work, I would be happy to share it with the rest of > the RTK community. > > Thank you for your help, > > Kindest regards, > > Vincent > > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > https://public.kitware.com/mailman/listinfo/rtk-users > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From slartibartfastlikesfjords at gmail.com Fri Jun 22 10:32:18 2018 From: slartibartfastlikesfjords at gmail.com (Slartibartfast Fjords) Date: Fri, 22 Jun 2018 10:32:18 -0400 Subject: [Rtk-users] Back-projection filter outputs only zeros Message-ID: Hi all, I've been trying for a while to use RTK in my own software to perform reconstructions. I've looked at the applications and examples to understand how to set it up but I can't get it working. I have my own data object which is stored in a single array. I used ITK's Import Image Filter to import the data in RTK. Right now I'm trying to get everything working with my own Shepp-Logan projections. So my pipeline looks like this for now: - Create the geometry - Create a Constant Image Source - Import my projection data - Set up the backprojection - Take the output of the back-projection and export it to my own data object The problem is that all that I get as the output is zeros everywhere, on the whole volume. I've tried skipping the back-projection to see if it was my data that was the problem, but then it works fine and I just get back my projections as the output. I've tried a few different back-projection methods, but it's always giving me zeros as the output. Has anybody experienced this before? What did I miss in my setup? I'll put a bit of my code below. My guess is that I didn't properly set the input image with the projections. Thanks a lot for your time! Adam Code: // Geometry rtk::ThreeDCircularProjectionGeometry::Pointer geometry; geometry = rtk::ThreeDCircularProjectionGeometry::New(); for (uint32_t p = 0; p < numberOfProjections; p++) { double angle = beginAngle + (double)p * (endAngle - beginAngle) / (double)numberOfProjections; geometry->AddProjection(sid, sdd, angle, isox, isoy, outAngle, inAngle, sourceOffsetX, sourceOffsetY); } TRY_AND_EXIT_ON_ITK_EXCEPTION(geometry->Update()); // Constant Image Source ConstantImageSourceType::SizeType reconstructionSize; reconstructionSize[0] = outputChannelSizeVector.getX(); reconstructionSize[1] = outputChannelSizeVector.getY(); reconstructionSize[2] = outputChannelSizeVector.getZ(); ConstantImageSourceType::PointType origin; origin[0] = outputOriginVector.getX(); origin[1] = outputOriginVector.getY(); origin[2] = outputOriginVector.getZ(); ConstantImageSourceType::SpacingType reconstructionSpacing; reconstructionSpacing[0] = outputSpacingVector.getX(); reconstructionSpacing[1] = outputSpacingVector.getY(); reconstructionSpacing[2] = outputSpacingVector.getZ(); ConstantImageSourceType::Pointer constantImageSource = ConstantImageSourceType::New(); constantImageSource->SetOrigin(origin); constantImageSource->SetSpacing(reconstructionSpacing); constantImageSource->SetSize(reconstructionSize); constantImageSource->SetConstant(0.0); // ITK Import Image Filter ImportFilterType::SizeType projectionsSize; projectionsSize[0] = projectionsXSize; projectionsSize[1] = projectionsYSize; projectionsSize[2] = projectionsZSize; ImportFilterType::SpacingType projectionsSpacing; projectionsSpacing[0] = projectionsXSpacing; projectionsSpacing[1] = projectionsYSpacing; projectionsSpacing[2] = projectionsZSpacing; // not that it matters much... const bool importImageFilterWillOwnTheBuffer = false; double projectionsOrigin[3] = { 0.0 }; ImportFilterType::Pointer importFilter = ImportFilterType::New(); ImportFilterType::IndexType importFilterStartIndex; importFilterStartIndex.Fill(0); ImportFilterType::RegionType region; region.SetIndex(importFilterStartIndex); region.SetSize(projectionsSize); importFilter->SetRegion(region); importFilter->SetOrigin(projectionsOrigin); importFilter->SetSpacing(projectionsSpacing); PixelType *projectionsDataBuffer = (PixelType *)projectionsChannelFloat. getTRawDataChunk(0); importFilter->SetImportPointer(projectionsDataBuffer, projectionsSize[0]* projectionsSize[1] * projectionsSize[2], importImageFilterWillOwnTheBuffer); TRY_AND_EXIT_ON_ITK_EXCEPTION(importFilter->Update()); // Backrprojection setup rtk::BackProjectionImageFilter::Pointer bp; bp = rtk::FDKBackProjectionImageFilter::New(); bp->SetInput(0, constantImageSource->GetOutput()); bp->SetInput(1, importFilter->GetOutput()); bp->SetGeometry(geometry); TRY_AND_EXIT_ON_ITK_EXCEPTION(bp->Update()); OutputImageType::PixelContainer::Element * iterator; iterator = bp->GetOutput()->GetBufferPointer(); PixelType *outputBuffer = (PixelType *)outputChannel.getTRawDataChunk(0); uint64_t numberOfPixels = xSize * ySize * zSize; for (uint64_t i = 0; i < numberOfPixels; i++) { outputBuffer [i] = *iterator; iterator++; } -------------- next part -------------- An HTML attachment was scrubbed... URL: From cyril.mory at creatis.insa-lyon.fr Fri Jun 22 10:47:49 2018 From: cyril.mory at creatis.insa-lyon.fr (Cyril Mory) Date: Fri, 22 Jun 2018 16:47:49 +0200 Subject: [Rtk-users] Back-projection filter outputs only zeros In-Reply-To: References: Message-ID: <33bb53ac-4ef8-5ec5-d909-7e68a0be1510@creatis.insa-lyon.fr> Hi, It might be caused by the line double projectionsOrigin[3] = { 0.0 }; With this setting, unless you specify an offset in x and y of your detector in the geometry, the source-isocenter ray will point to the lower-left corner of your projections, so you may end up in a setting where none of the rays go through your volume. To get centered projections, you should set their origin to (Size - 1) * Spacing / 2. Obviously only the first two dimensions matter, the third is unused. Have a look at the metadata of the projections generated by wiki examples, e.g. http://wiki.openrtk.org/index.php/RTK/Scripts/FDK : their origin is not [0,0,0]. Regards, Cyril On 22/06/2018 16:32, Slartibartfast Fjords wrote: > Hi all, > > I've been trying for a while to use RTK in my own software to perform > reconstructions. I've looked at the applications and examples to > understand how to set it up but I can't get it working. > > I have my own data object which is stored in a single array. I used > ITK's Import Image Filter to import the data in RTK. Right now I'm > trying to get everything working with my own Shepp-Logan projections. > So my pipeline looks like this for now: > - Create the geometry > - Create a Constant Image Source > - Import my projection data > - Set up the backprojection > - Take the output of the back-projection and export it to my own data > object > > The problem is that all that I get as the output is zeros everywhere, > on the whole volume. I've tried skipping the back-projection to see if > it was my data that was the problem, but then it works fine and I just > get back my projections as the output. I've tried a few different > back-projection methods, but it's always giving me zeros as the output. > > Has anybody experienced this before? What did I miss in my setup? I'll > put a bit of my code below. My guess is that I didn't properly set the > input image with the projections. > > Thanks a lot for your time! > > Adam > > Code: > > // Geometry > rtk::ThreeDCircularProjectionGeometry::Pointer geometry; > geometry = rtk::ThreeDCircularProjectionGeometry::New(); > for (uint32_t p = 0; p < numberOfProjections; p++) > { > double angle = beginAngle + (double)p * (endAngle - beginAngle) / > (double)numberOfProjections; > geometry->AddProjection(sid, sdd, angle, isox, isoy, outAngle, > inAngle, sourceOffsetX, sourceOffsetY); > } > TRY_AND_EXIT_ON_ITK_EXCEPTION(geometry->Update()); > > // Constant Image Source > ConstantImageSourceType::SizeType reconstructionSize; > reconstructionSize[0] = outputChannelSizeVector.getX(); > reconstructionSize[1] = outputChannelSizeVector.getY(); > reconstructionSize[2] = outputChannelSizeVector.getZ(); > > ConstantImageSourceType::PointType origin; > origin[0] = outputOriginVector.getX(); > origin[1] = outputOriginVector.getY(); > origin[2] = outputOriginVector.getZ(); > > ConstantImageSourceType::SpacingType reconstructionSpacing; > reconstructionSpacing[0] = outputSpacingVector.getX(); > reconstructionSpacing[1] = outputSpacingVector.getY(); > reconstructionSpacing[2] = outputSpacingVector.getZ(); > > ConstantImageSourceType::Pointer constantImageSource = > ConstantImageSourceType::New(); > constantImageSource->SetOrigin(origin); > constantImageSource->SetSpacing(reconstructionSpacing); > constantImageSource->SetSize(reconstructionSize); > constantImageSource->SetConstant(0.0); > > // ITK Import Image Filter > ImportFilterType::SizeType projectionsSize; > projectionsSize[0] = projectionsXSize; > projectionsSize[1] = projectionsYSize; > projectionsSize[2] = projectionsZSize; > > ImportFilterType::SpacingType projectionsSpacing; > projectionsSpacing[0] = projectionsXSpacing; > projectionsSpacing[1] = projectionsYSpacing; > projectionsSpacing[2] = projectionsZSpacing; // not that it matters > much... > > const bool importImageFilterWillOwnTheBuffer = false; > > double projectionsOrigin[3] = { 0.0 }; > > ImportFilterType::Pointer importFilter = ImportFilterType::New(); > ImportFilterType::IndexType importFilterStartIndex; > importFilterStartIndex.Fill(0); > > ImportFilterType::RegionType region; > region.SetIndex(importFilterStartIndex); > region.SetSize(projectionsSize); > > importFilter->SetRegion(region); > importFilter->SetOrigin(projectionsOrigin); > importFilter->SetSpacing(projectionsSpacing); > > PixelType *projectionsDataBuffer = (PixelType > *)projectionsChannelFloat.getTRawDataChunk(0); > importFilter->SetImportPointer(projectionsDataBuffer, > projectionsSize[0]* projectionsSize[1] * projectionsSize[2], > importImageFilterWillOwnTheBuffer); > > TRY_AND_EXIT_ON_ITK_EXCEPTION(importFilter->Update()); > > // Backrprojection setup > rtk::BackProjectionImageFilter OutputImageType>::Pointer bp; > bp = rtk::FDKBackProjectionImageFilter OutputImageType>::New(); > > bp->SetInput(0, constantImageSource->GetOutput()); > bp->SetInput(1, importFilter->GetOutput()); > bp->SetGeometry(geometry); > TRY_AND_EXIT_ON_ITK_EXCEPTION(bp->Update()); > > OutputImageType::PixelContainer::Element * iterator; > iterator = bp->GetOutput()->GetBufferPointer(); > > PixelType *outputBuffer = (PixelType *)outputChannel.getTRawDataChunk(0); > uint64_t numberOfPixels = xSize * ySize * zSize; > for (uint64_t i = 0; i < numberOfPixels; i++) > { > outputBuffer[i] = *iterator; > iterator++; > } > > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > https://public.kitware.com/mailman/listinfo/rtk-users -------------- next part -------------- An HTML attachment was scrubbed... URL: