# Specifying type of interpolated image in a struct

**URL:** <https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978>\
**Category:** General Usage\
**Tags:** interpolations\
**Created:** [February 21, 2023, 8:21pm UTC](https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978 "2023-02-21T20:21:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakshith95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakshith95/32/44606_2.png) [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Post date:** [February 21, 2023, 8:21pm UTC](https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978/1 "2023-02-21T20:21:15Z")

</div>

I have a struct

```julia
struct some_struct{}
    interpolated_img
end

```

where I want to store an interpolation ‘image’. When I print the `typeof()` such an image, I get `Interpolations.BSplineInterpolation{Gray{Float64}, 2, Matrix{Gray{Float64}}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}` .

If I don’t specify any type, it assumes it as `Any`, but if I want to specify the type should I specify it as something like  
`interpolated_img::Interpolations.BSplineInterpolation{Gray{Float64}, 2, Matrix{Gray{Float64}}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}`  
or is there some better way to do this?

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [February 21, 2023, 8:58pm UTC](https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978/2 "2023-02-21T20:58:37Z")

</div>

You can add a [type parameter](https://docs.julialang.org/en/v1/manual/types/#Parametric-Types) that will be filled in when compiled.

```julia
struct some_struct{T}
    interpolated_img::T
end

```

---

<div class="post-metadata">

**Author:** ![rakshith95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakshith95/32/44606_2.png) [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Post date:** [February 21, 2023, 9:08pm UTC](https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978/3 "2023-02-21T21:08:08Z")

</div>

Perfect, thank you!
